react-window 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.d.ts +1 -1
- package/dist/react-window.js +599 -561
- package/dist/react-window.js.map +1 -1
- package/package.json +2 -2
package/dist/react-window.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
function
|
|
2
|
+
import { jsx as re } from "react/jsx-runtime";
|
|
3
|
+
import { useState as H, useLayoutEffect as oe, useEffect as ee, useMemo as W, useRef as G, useCallback as $, memo as ue, useImperativeHandle as he, createElement as K } from "react";
|
|
4
|
+
function Oe(e) {
|
|
5
5
|
let t = e;
|
|
6
6
|
for (; t; ) {
|
|
7
7
|
if (t.dir)
|
|
@@ -11,13 +11,19 @@ function be(e) {
|
|
|
11
11
|
return !1;
|
|
12
12
|
}
|
|
13
13
|
function me(e, t) {
|
|
14
|
-
const [s, r] =
|
|
15
|
-
return
|
|
16
|
-
t ? r(t === "rtl") : e && r(
|
|
14
|
+
const [s, r] = H(t === "rtl");
|
|
15
|
+
return oe(() => {
|
|
16
|
+
t ? r(t === "rtl") : e && r(Oe(e));
|
|
17
17
|
}, [t, e]), s;
|
|
18
18
|
}
|
|
19
|
-
const Y = typeof window < "u" ?
|
|
20
|
-
function
|
|
19
|
+
const Y = typeof window < "u" ? oe : ee;
|
|
20
|
+
function ie(e) {
|
|
21
|
+
return e?.ownerDocument.defaultView ?? window;
|
|
22
|
+
}
|
|
23
|
+
function ve(e) {
|
|
24
|
+
return ie(e).ResizeObserver ?? (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
|
|
25
|
+
}
|
|
26
|
+
function le(e) {
|
|
21
27
|
if (e !== void 0)
|
|
22
28
|
switch (typeof e) {
|
|
23
29
|
case "number":
|
|
@@ -29,80 +35,84 @@ function ae(e) {
|
|
|
29
35
|
}
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
|
-
function
|
|
38
|
+
function ze({
|
|
33
39
|
box: e,
|
|
34
40
|
defaultHeight: t,
|
|
35
41
|
defaultWidth: s,
|
|
36
42
|
disabled: r,
|
|
37
|
-
element:
|
|
38
|
-
mode:
|
|
39
|
-
style:
|
|
43
|
+
element: n,
|
|
44
|
+
mode: i,
|
|
45
|
+
style: l
|
|
40
46
|
}) {
|
|
41
|
-
const { styleHeight:
|
|
47
|
+
const { styleHeight: a, styleWidth: c } = W(
|
|
42
48
|
() => ({
|
|
43
|
-
styleHeight:
|
|
44
|
-
styleWidth:
|
|
49
|
+
styleHeight: le(l?.height),
|
|
50
|
+
styleWidth: le(l?.width)
|
|
45
51
|
}),
|
|
46
|
-
[
|
|
47
|
-
), [f,
|
|
52
|
+
[l?.height, l?.width]
|
|
53
|
+
), [f, h] = H({
|
|
48
54
|
height: t,
|
|
49
55
|
width: s
|
|
50
|
-
}),
|
|
56
|
+
}), o = r || i === "only-height" && a !== void 0 || i === "only-width" && c !== void 0 || a !== void 0 && c !== void 0;
|
|
51
57
|
return Y(() => {
|
|
52
|
-
if (
|
|
58
|
+
if (n === null || o)
|
|
53
59
|
return;
|
|
54
|
-
const u =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
const u = ve(n);
|
|
61
|
+
if (!u)
|
|
62
|
+
return;
|
|
63
|
+
const d = new u((p) => {
|
|
64
|
+
for (const v of p) {
|
|
65
|
+
const { contentRect: x, target: g } = v;
|
|
66
|
+
n === g && h((z) => z.height === x.height && z.width === x.width ? z : {
|
|
67
|
+
height: x.height,
|
|
68
|
+
width: x.width
|
|
60
69
|
});
|
|
61
70
|
}
|
|
62
71
|
});
|
|
63
|
-
return
|
|
64
|
-
|
|
72
|
+
return d.observe(n, { box: e }), () => {
|
|
73
|
+
d?.unobserve(n);
|
|
65
74
|
};
|
|
66
|
-
}, [e,
|
|
75
|
+
}, [e, o, n, a, c]), W(
|
|
67
76
|
() => ({
|
|
68
|
-
height:
|
|
77
|
+
height: a ?? f.height,
|
|
69
78
|
width: c ?? f.width
|
|
70
79
|
}),
|
|
71
|
-
[f,
|
|
80
|
+
[f, a, c]
|
|
72
81
|
);
|
|
73
82
|
}
|
|
74
|
-
function
|
|
75
|
-
const t =
|
|
83
|
+
function J(e) {
|
|
84
|
+
const t = G(() => {
|
|
76
85
|
throw new Error("Cannot call an event handler while rendering.");
|
|
77
86
|
});
|
|
78
87
|
return Y(() => {
|
|
79
88
|
t.current = e;
|
|
80
89
|
}, [e]), $((...s) => t.current?.(...s), [t]);
|
|
81
90
|
}
|
|
82
|
-
|
|
83
|
-
function
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
const ae = /* @__PURE__ */ new WeakMap();
|
|
92
|
+
function ye(e = !1, t = document) {
|
|
93
|
+
let s = ae.get(t);
|
|
94
|
+
if (s === void 0 || e) {
|
|
95
|
+
const r = t.createElement("div"), n = r.style;
|
|
96
|
+
n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
|
|
97
|
+
const i = t.createElement("div"), l = i.style;
|
|
98
|
+
l.width = "100px", l.height = "100px", r.appendChild(i), t.body.appendChild(r), r.scrollLeft > 0 ? s = "positive-descending" : (r.scrollLeft = 1, r.scrollLeft === 0 ? s = "negative" : s = "positive-ascending"), t.body.removeChild(r), ae.set(t, s);
|
|
89
99
|
}
|
|
90
|
-
return
|
|
100
|
+
return s;
|
|
91
101
|
}
|
|
92
|
-
function
|
|
102
|
+
function P({
|
|
93
103
|
containerElement: e,
|
|
94
104
|
direction: t,
|
|
95
105
|
isRtl: s,
|
|
96
106
|
scrollOffset: r
|
|
97
107
|
}) {
|
|
98
108
|
if (t === "horizontal" && s)
|
|
99
|
-
switch (
|
|
109
|
+
switch (ye(!1, e?.ownerDocument ?? document)) {
|
|
100
110
|
case "negative":
|
|
101
111
|
return -r;
|
|
102
112
|
case "positive-descending": {
|
|
103
113
|
if (e) {
|
|
104
|
-
const { clientWidth:
|
|
105
|
-
return
|
|
114
|
+
const { clientWidth: n, scrollWidth: i } = e;
|
|
115
|
+
return i - n - r;
|
|
106
116
|
}
|
|
107
117
|
break;
|
|
108
118
|
}
|
|
@@ -113,7 +123,7 @@ function L(e, t = "Assertion error") {
|
|
|
113
123
|
if (!e)
|
|
114
124
|
throw console.error(t), Error(t);
|
|
115
125
|
}
|
|
116
|
-
function
|
|
126
|
+
function N(e, t) {
|
|
117
127
|
if (e === t)
|
|
118
128
|
return !0;
|
|
119
129
|
if (!!e != !!t || (L(e !== void 0), L(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
|
|
@@ -123,7 +133,7 @@ function _(e, t) {
|
|
|
123
133
|
return !1;
|
|
124
134
|
return !0;
|
|
125
135
|
}
|
|
126
|
-
function
|
|
136
|
+
function pe({
|
|
127
137
|
cachedBounds: e,
|
|
128
138
|
itemCount: t,
|
|
129
139
|
itemSize: s
|
|
@@ -137,60 +147,60 @@ function ue({
|
|
|
137
147
|
e.size === 0 ? 0 : e.size - 1
|
|
138
148
|
);
|
|
139
149
|
L(r !== void 0, "Unexpected bounds cache miss");
|
|
140
|
-
const
|
|
141
|
-
return t *
|
|
150
|
+
const n = (r.scrollOffset + r.size) / e.size;
|
|
151
|
+
return t * n;
|
|
142
152
|
}
|
|
143
153
|
}
|
|
144
|
-
function
|
|
154
|
+
function Se({
|
|
145
155
|
align: e,
|
|
146
156
|
cachedBounds: t,
|
|
147
157
|
index: s,
|
|
148
158
|
itemCount: r,
|
|
149
|
-
itemSize:
|
|
150
|
-
containerScrollOffset:
|
|
151
|
-
containerSize:
|
|
159
|
+
itemSize: n,
|
|
160
|
+
containerScrollOffset: i,
|
|
161
|
+
containerSize: l
|
|
152
162
|
}) {
|
|
153
163
|
if (s < 0 || s >= r)
|
|
154
164
|
throw RangeError(`Invalid index specified: ${s}`, {
|
|
155
165
|
cause: `Index ${s} is not within the range of 0 - ${r - 1}`
|
|
156
166
|
});
|
|
157
|
-
const
|
|
167
|
+
const a = t.get(s), c = pe({
|
|
158
168
|
cachedBounds: t,
|
|
159
169
|
itemCount: r,
|
|
160
|
-
itemSize:
|
|
170
|
+
itemSize: n
|
|
161
171
|
}), f = Math.max(
|
|
162
172
|
0,
|
|
163
|
-
Math.min(c -
|
|
164
|
-
),
|
|
173
|
+
Math.min(c - l, a.scrollOffset)
|
|
174
|
+
), h = Math.max(
|
|
165
175
|
0,
|
|
166
|
-
|
|
167
|
-
),
|
|
168
|
-
switch (e === "smart" && (e =
|
|
176
|
+
a.scrollOffset - l + a.size
|
|
177
|
+
), o = a.size > l ? i >= a.scrollOffset && i <= h : i >= h && i <= a.scrollOffset;
|
|
178
|
+
switch (e === "smart" && (e = o ? "auto" : "center"), e) {
|
|
169
179
|
case "start":
|
|
170
180
|
return f;
|
|
171
181
|
case "end":
|
|
172
|
-
return
|
|
182
|
+
return h;
|
|
173
183
|
case "center":
|
|
174
184
|
return Math.max(
|
|
175
185
|
0,
|
|
176
186
|
Math.min(
|
|
177
|
-
c -
|
|
178
|
-
|
|
187
|
+
c - l,
|
|
188
|
+
a.scrollOffset + a.size / 2 - l / 2
|
|
179
189
|
)
|
|
180
190
|
);
|
|
181
191
|
case "auto":
|
|
182
192
|
default:
|
|
183
|
-
return
|
|
193
|
+
return o ? i : i < h ? h : f;
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
|
-
function
|
|
196
|
+
function se({
|
|
187
197
|
cachedBounds: e,
|
|
188
198
|
containerScrollOffset: t,
|
|
189
199
|
containerSize: s,
|
|
190
200
|
itemCount: r,
|
|
191
|
-
overscanCount:
|
|
201
|
+
overscanCount: n
|
|
192
202
|
}) {
|
|
193
|
-
const
|
|
203
|
+
const i = r - 1;
|
|
194
204
|
if (r === 0)
|
|
195
205
|
return {
|
|
196
206
|
startIndexVisible: 0,
|
|
@@ -198,45 +208,45 @@ function re({
|
|
|
198
208
|
startIndexOverscan: 0,
|
|
199
209
|
stopIndexOverscan: -1
|
|
200
210
|
};
|
|
201
|
-
let
|
|
211
|
+
let l, a;
|
|
202
212
|
const { itemSize: c } = e;
|
|
203
213
|
if (c !== void 0 && c > 0)
|
|
204
|
-
|
|
214
|
+
l = Math.max(
|
|
205
215
|
0,
|
|
206
|
-
Math.min(
|
|
207
|
-
),
|
|
208
|
-
|
|
216
|
+
Math.min(i, Math.floor(t / c))
|
|
217
|
+
), a = Math.max(
|
|
218
|
+
l,
|
|
209
219
|
Math.min(
|
|
210
|
-
|
|
220
|
+
i,
|
|
211
221
|
Math.ceil((t + s) / c) - 1
|
|
212
222
|
)
|
|
213
223
|
);
|
|
214
224
|
else {
|
|
215
|
-
let f = 0,
|
|
216
|
-
for (;
|
|
217
|
-
const u = e.get(
|
|
218
|
-
|
|
219
|
-
f = i + 1, i = Math.min(n, i + d), d *= 2;
|
|
225
|
+
let f = 0, h = Math.min(i, Math.max(0, e.size - 1));
|
|
226
|
+
for (; f < h; ) {
|
|
227
|
+
const o = Math.floor((f + h) / 2), u = e.get(o);
|
|
228
|
+
u.scrollOffset + u.size > t ? h = o : f = o + 1;
|
|
220
229
|
}
|
|
221
230
|
for (; f < i; ) {
|
|
222
|
-
const
|
|
223
|
-
|
|
231
|
+
const o = e.get(f);
|
|
232
|
+
if (o.scrollOffset + o.size > t) break;
|
|
233
|
+
f++;
|
|
224
234
|
}
|
|
225
|
-
for (
|
|
226
|
-
const
|
|
227
|
-
if (
|
|
235
|
+
for (l = f, a = f; a < i; ) {
|
|
236
|
+
const o = e.get(a);
|
|
237
|
+
if (o.scrollOffset + o.size >= t + s)
|
|
228
238
|
break;
|
|
229
|
-
|
|
239
|
+
a++;
|
|
230
240
|
}
|
|
231
241
|
}
|
|
232
242
|
return {
|
|
233
|
-
startIndexVisible:
|
|
234
|
-
stopIndexVisible:
|
|
235
|
-
startIndexOverscan: Math.max(0,
|
|
236
|
-
stopIndexOverscan: Math.min(
|
|
243
|
+
startIndexVisible: l,
|
|
244
|
+
stopIndexVisible: a,
|
|
245
|
+
startIndexOverscan: Math.max(0, l - n),
|
|
246
|
+
stopIndexOverscan: Math.min(i, a + n)
|
|
237
247
|
};
|
|
238
248
|
}
|
|
239
|
-
function
|
|
249
|
+
function Te({
|
|
240
250
|
itemCount: e,
|
|
241
251
|
itemProps: t,
|
|
242
252
|
itemSize: s
|
|
@@ -244,51 +254,51 @@ function ze({
|
|
|
244
254
|
const r = /* @__PURE__ */ new Map();
|
|
245
255
|
return {
|
|
246
256
|
itemSize: typeof s == "number" ? s : void 0,
|
|
247
|
-
get(
|
|
248
|
-
if (L(
|
|
249
|
-
L(
|
|
250
|
-
let
|
|
251
|
-
return
|
|
257
|
+
get(n) {
|
|
258
|
+
if (L(n < e, `Invalid index ${n}`), typeof s == "number") {
|
|
259
|
+
L(n >= 0, `Invalid index ${n}`);
|
|
260
|
+
let l = r.get(n);
|
|
261
|
+
return l === void 0 && (l = { size: s, scrollOffset: n * s }, r.set(n, l)), l;
|
|
252
262
|
}
|
|
253
|
-
for (; r.size - 1 <
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
r.set(
|
|
257
|
-
size:
|
|
263
|
+
for (; r.size - 1 < n; ) {
|
|
264
|
+
const l = r.size, a = s(l, t);
|
|
265
|
+
if (l === 0)
|
|
266
|
+
r.set(l, {
|
|
267
|
+
size: a,
|
|
258
268
|
scrollOffset: 0
|
|
259
269
|
});
|
|
260
270
|
else {
|
|
261
|
-
const c = r.get(
|
|
271
|
+
const c = r.get(l - 1);
|
|
262
272
|
L(
|
|
263
273
|
c !== void 0,
|
|
264
|
-
`Unexpected bounds cache miss for index ${
|
|
265
|
-
), r.set(
|
|
274
|
+
`Unexpected bounds cache miss for index ${n}`
|
|
275
|
+
), r.set(l, {
|
|
266
276
|
scrollOffset: c.scrollOffset + c.size,
|
|
267
|
-
size:
|
|
277
|
+
size: a
|
|
268
278
|
});
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
|
-
const
|
|
281
|
+
const i = r.get(n);
|
|
272
282
|
return L(
|
|
273
|
-
|
|
274
|
-
`Unexpected bounds cache miss for index ${
|
|
275
|
-
),
|
|
283
|
+
i !== void 0,
|
|
284
|
+
`Unexpected bounds cache miss for index ${n}`
|
|
285
|
+
), i;
|
|
276
286
|
},
|
|
277
|
-
set(
|
|
278
|
-
r.set(
|
|
287
|
+
set(n, i) {
|
|
288
|
+
r.set(n, i);
|
|
279
289
|
},
|
|
280
290
|
get size() {
|
|
281
291
|
return r.size;
|
|
282
292
|
}
|
|
283
293
|
};
|
|
284
294
|
}
|
|
285
|
-
function
|
|
295
|
+
function Me({
|
|
286
296
|
itemCount: e,
|
|
287
297
|
itemProps: t,
|
|
288
298
|
itemSize: s
|
|
289
299
|
}) {
|
|
290
|
-
return
|
|
291
|
-
() =>
|
|
300
|
+
return W(
|
|
301
|
+
() => Te({
|
|
292
302
|
itemCount: e,
|
|
293
303
|
itemProps: t,
|
|
294
304
|
itemSize: s
|
|
@@ -296,7 +306,7 @@ function ye({
|
|
|
296
306
|
[e, t, s]
|
|
297
307
|
);
|
|
298
308
|
}
|
|
299
|
-
function
|
|
309
|
+
function Ee({
|
|
300
310
|
containerSize: e,
|
|
301
311
|
itemSize: t
|
|
302
312
|
}) {
|
|
@@ -319,423 +329,423 @@ function Se({
|
|
|
319
329
|
}
|
|
320
330
|
return s;
|
|
321
331
|
}
|
|
322
|
-
function
|
|
332
|
+
function ne({
|
|
323
333
|
containerElement: e,
|
|
324
334
|
containerStyle: t,
|
|
325
335
|
defaultContainerSize: s = 0,
|
|
326
336
|
direction: r,
|
|
327
|
-
isRtl:
|
|
328
|
-
itemCount:
|
|
329
|
-
itemProps:
|
|
330
|
-
itemSize:
|
|
337
|
+
isRtl: n = !1,
|
|
338
|
+
itemCount: i,
|
|
339
|
+
itemProps: l,
|
|
340
|
+
itemSize: a,
|
|
331
341
|
onResize: c,
|
|
332
342
|
overscanCount: f
|
|
333
343
|
}) {
|
|
334
|
-
const { height:
|
|
344
|
+
const { height: h = s, width: o = s } = ze({
|
|
335
345
|
defaultHeight: r === "vertical" ? s : void 0,
|
|
336
346
|
defaultWidth: r === "horizontal" ? s : void 0,
|
|
337
347
|
element: e,
|
|
338
348
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
339
349
|
style: t
|
|
340
|
-
}), u =
|
|
350
|
+
}), u = G({
|
|
341
351
|
height: 0,
|
|
342
352
|
width: 0
|
|
343
|
-
}),
|
|
344
|
-
|
|
353
|
+
}), d = r === "vertical" ? h : o, p = Ee({ containerSize: d, itemSize: a });
|
|
354
|
+
oe(() => {
|
|
345
355
|
if (typeof c == "function") {
|
|
346
|
-
const
|
|
347
|
-
(
|
|
356
|
+
const b = u.current;
|
|
357
|
+
(b.height !== h || b.width !== o) && (c({ height: h, width: o }, { ...b }), b.height = h, b.width = o);
|
|
348
358
|
}
|
|
349
|
-
}, [
|
|
350
|
-
const
|
|
351
|
-
itemCount:
|
|
352
|
-
itemProps:
|
|
353
|
-
itemSize:
|
|
354
|
-
}),
|
|
355
|
-
(
|
|
356
|
-
[
|
|
357
|
-
), [g,
|
|
358
|
-
() =>
|
|
359
|
-
cachedBounds:
|
|
359
|
+
}, [h, c, o]);
|
|
360
|
+
const v = Me({
|
|
361
|
+
itemCount: i,
|
|
362
|
+
itemProps: l,
|
|
363
|
+
itemSize: p
|
|
364
|
+
}), x = $(
|
|
365
|
+
(b) => v.get(b),
|
|
366
|
+
[v]
|
|
367
|
+
), [g, z] = H(
|
|
368
|
+
() => se({
|
|
369
|
+
cachedBounds: v,
|
|
360
370
|
// TODO Potentially support a defaultScrollOffset prop?
|
|
361
371
|
containerScrollOffset: 0,
|
|
362
|
-
containerSize:
|
|
363
|
-
itemCount:
|
|
372
|
+
containerSize: d,
|
|
373
|
+
itemCount: i,
|
|
364
374
|
overscanCount: f
|
|
365
375
|
})
|
|
366
376
|
), {
|
|
367
|
-
startIndexVisible:
|
|
368
|
-
startIndexOverscan:
|
|
377
|
+
startIndexVisible: M,
|
|
378
|
+
startIndexOverscan: E,
|
|
369
379
|
stopIndexVisible: F,
|
|
370
|
-
stopIndexOverscan:
|
|
380
|
+
stopIndexOverscan: w
|
|
371
381
|
} = {
|
|
372
|
-
startIndexVisible: Math.min(
|
|
373
|
-
startIndexOverscan: Math.min(
|
|
374
|
-
stopIndexVisible: Math.min(
|
|
375
|
-
stopIndexOverscan: Math.min(
|
|
376
|
-
},
|
|
377
|
-
() =>
|
|
378
|
-
cachedBounds:
|
|
379
|
-
itemCount:
|
|
380
|
-
itemSize:
|
|
382
|
+
startIndexVisible: Math.min(i - 1, g.startIndexVisible),
|
|
383
|
+
startIndexOverscan: Math.min(i - 1, g.startIndexOverscan),
|
|
384
|
+
stopIndexVisible: Math.min(i - 1, g.stopIndexVisible),
|
|
385
|
+
stopIndexOverscan: Math.min(i - 1, g.stopIndexOverscan)
|
|
386
|
+
}, D = $(
|
|
387
|
+
() => pe({
|
|
388
|
+
cachedBounds: v,
|
|
389
|
+
itemCount: i,
|
|
390
|
+
itemSize: p
|
|
381
391
|
}),
|
|
382
|
-
[
|
|
383
|
-
),
|
|
384
|
-
(
|
|
385
|
-
const
|
|
392
|
+
[v, i, p]
|
|
393
|
+
), I = $(
|
|
394
|
+
(b) => {
|
|
395
|
+
const O = P({
|
|
386
396
|
containerElement: e,
|
|
387
397
|
direction: r,
|
|
388
|
-
isRtl:
|
|
389
|
-
scrollOffset:
|
|
398
|
+
isRtl: n,
|
|
399
|
+
scrollOffset: b
|
|
390
400
|
});
|
|
391
|
-
return
|
|
392
|
-
cachedBounds:
|
|
393
|
-
containerScrollOffset:
|
|
394
|
-
containerSize:
|
|
395
|
-
itemCount:
|
|
401
|
+
return se({
|
|
402
|
+
cachedBounds: v,
|
|
403
|
+
containerScrollOffset: O,
|
|
404
|
+
containerSize: d,
|
|
405
|
+
itemCount: i,
|
|
396
406
|
overscanCount: f
|
|
397
407
|
});
|
|
398
408
|
},
|
|
399
409
|
[
|
|
400
|
-
|
|
410
|
+
v,
|
|
401
411
|
e,
|
|
402
|
-
|
|
412
|
+
d,
|
|
403
413
|
r,
|
|
404
|
-
o,
|
|
405
414
|
n,
|
|
415
|
+
i,
|
|
406
416
|
f
|
|
407
417
|
]
|
|
408
418
|
);
|
|
409
419
|
Y(() => {
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
}, [e, r,
|
|
420
|
+
const b = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
|
|
421
|
+
z(I(b));
|
|
422
|
+
}, [e, r, I]), Y(() => {
|
|
413
423
|
if (!e)
|
|
414
424
|
return;
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const { scrollLeft:
|
|
425
|
+
const b = () => {
|
|
426
|
+
z((O) => {
|
|
427
|
+
const { scrollLeft: V, scrollTop: y } = e, S = P({
|
|
418
428
|
containerElement: e,
|
|
419
429
|
direction: r,
|
|
420
|
-
isRtl:
|
|
421
|
-
scrollOffset: r === "vertical" ?
|
|
422
|
-
}),
|
|
423
|
-
cachedBounds:
|
|
424
|
-
containerScrollOffset:
|
|
425
|
-
containerSize:
|
|
426
|
-
itemCount:
|
|
430
|
+
isRtl: n,
|
|
431
|
+
scrollOffset: r === "vertical" ? y : V
|
|
432
|
+
}), q = se({
|
|
433
|
+
cachedBounds: v,
|
|
434
|
+
containerScrollOffset: S,
|
|
435
|
+
containerSize: d,
|
|
436
|
+
itemCount: i,
|
|
427
437
|
overscanCount: f
|
|
428
438
|
});
|
|
429
|
-
return
|
|
439
|
+
return N(q, O) ? O : q;
|
|
430
440
|
});
|
|
431
441
|
};
|
|
432
|
-
return e.addEventListener("scroll",
|
|
433
|
-
e.removeEventListener("scroll",
|
|
442
|
+
return e.addEventListener("scroll", b), () => {
|
|
443
|
+
e.removeEventListener("scroll", b);
|
|
434
444
|
};
|
|
435
445
|
}, [
|
|
436
|
-
|
|
446
|
+
v,
|
|
437
447
|
e,
|
|
438
|
-
|
|
448
|
+
d,
|
|
439
449
|
r,
|
|
440
|
-
o,
|
|
441
450
|
n,
|
|
451
|
+
i,
|
|
442
452
|
f
|
|
443
453
|
]);
|
|
444
|
-
const
|
|
454
|
+
const _ = J(
|
|
445
455
|
({
|
|
446
|
-
align:
|
|
447
|
-
containerScrollOffset:
|
|
448
|
-
index:
|
|
456
|
+
align: b = "auto",
|
|
457
|
+
containerScrollOffset: O,
|
|
458
|
+
index: V
|
|
449
459
|
}) => {
|
|
450
|
-
let
|
|
451
|
-
align:
|
|
452
|
-
cachedBounds:
|
|
453
|
-
containerScrollOffset:
|
|
460
|
+
let y = Se({
|
|
461
|
+
align: b,
|
|
462
|
+
cachedBounds: v,
|
|
463
|
+
containerScrollOffset: P({
|
|
454
464
|
containerElement: e,
|
|
455
465
|
direction: r,
|
|
456
|
-
isRtl:
|
|
457
|
-
scrollOffset:
|
|
466
|
+
isRtl: n,
|
|
467
|
+
scrollOffset: O
|
|
458
468
|
}),
|
|
459
|
-
containerSize:
|
|
460
|
-
index:
|
|
461
|
-
itemCount:
|
|
462
|
-
itemSize:
|
|
469
|
+
containerSize: d,
|
|
470
|
+
index: V,
|
|
471
|
+
itemCount: i,
|
|
472
|
+
itemSize: p
|
|
463
473
|
});
|
|
464
474
|
if (e) {
|
|
465
|
-
if (
|
|
475
|
+
if (y = P({
|
|
466
476
|
containerElement: e,
|
|
467
477
|
direction: r,
|
|
468
|
-
isRtl:
|
|
469
|
-
scrollOffset:
|
|
478
|
+
isRtl: n,
|
|
479
|
+
scrollOffset: y
|
|
470
480
|
}), typeof e.scrollTo != "function") {
|
|
471
|
-
const
|
|
472
|
-
|
|
481
|
+
const S = I(y);
|
|
482
|
+
N(g, S) || z(S);
|
|
473
483
|
}
|
|
474
|
-
return
|
|
484
|
+
return y;
|
|
475
485
|
}
|
|
476
486
|
}
|
|
477
487
|
);
|
|
478
488
|
return {
|
|
479
|
-
getCellBounds:
|
|
480
|
-
getEstimatedSize:
|
|
481
|
-
scrollToIndex:
|
|
482
|
-
startIndexOverscan:
|
|
483
|
-
startIndexVisible:
|
|
484
|
-
stopIndexOverscan:
|
|
489
|
+
getCellBounds: x,
|
|
490
|
+
getEstimatedSize: D,
|
|
491
|
+
scrollToIndex: _,
|
|
492
|
+
startIndexOverscan: E,
|
|
493
|
+
startIndexVisible: M,
|
|
494
|
+
stopIndexOverscan: w,
|
|
485
495
|
stopIndexVisible: F
|
|
486
496
|
};
|
|
487
497
|
}
|
|
488
|
-
function
|
|
489
|
-
const [t, s] =
|
|
490
|
-
return
|
|
498
|
+
function ge(e) {
|
|
499
|
+
const [t, s] = H(e);
|
|
500
|
+
return N(t, e) ? t : (s(e), e);
|
|
491
501
|
}
|
|
492
|
-
function
|
|
502
|
+
function be(e, t) {
|
|
493
503
|
const {
|
|
494
504
|
ariaAttributes: s,
|
|
495
505
|
style: r,
|
|
496
|
-
...
|
|
506
|
+
...n
|
|
497
507
|
} = e, {
|
|
498
|
-
ariaAttributes:
|
|
499
|
-
style:
|
|
500
|
-
...
|
|
508
|
+
ariaAttributes: i,
|
|
509
|
+
style: l,
|
|
510
|
+
...a
|
|
501
511
|
} = t;
|
|
502
|
-
return
|
|
512
|
+
return N(s, i) && N(r, l) && N(n, a);
|
|
503
513
|
}
|
|
504
|
-
function
|
|
514
|
+
function ke({
|
|
505
515
|
cellComponent: e,
|
|
506
516
|
cellProps: t,
|
|
507
517
|
children: s,
|
|
508
518
|
className: r,
|
|
509
|
-
columnCount:
|
|
510
|
-
columnKey:
|
|
511
|
-
columnWidth:
|
|
512
|
-
defaultHeight:
|
|
519
|
+
columnCount: n,
|
|
520
|
+
columnKey: i,
|
|
521
|
+
columnWidth: l,
|
|
522
|
+
defaultHeight: a = 0,
|
|
513
523
|
defaultWidth: c = 0,
|
|
514
524
|
dir: f,
|
|
515
|
-
gridRef:
|
|
516
|
-
onCellsRendered:
|
|
525
|
+
gridRef: h,
|
|
526
|
+
onCellsRendered: o,
|
|
517
527
|
onResize: u,
|
|
518
|
-
overscanCount:
|
|
519
|
-
rowCount:
|
|
520
|
-
rowHeight:
|
|
521
|
-
rowKey:
|
|
528
|
+
overscanCount: d = 3,
|
|
529
|
+
rowCount: p,
|
|
530
|
+
rowHeight: v,
|
|
531
|
+
rowKey: x,
|
|
522
532
|
style: g,
|
|
523
|
-
tagName:
|
|
524
|
-
...
|
|
533
|
+
tagName: z = "div",
|
|
534
|
+
...M
|
|
525
535
|
}) {
|
|
526
|
-
const
|
|
527
|
-
() =>
|
|
536
|
+
const E = ge(t), F = W(
|
|
537
|
+
() => ue(e, be),
|
|
528
538
|
[e]
|
|
529
|
-
), [
|
|
530
|
-
getCellBounds:
|
|
531
|
-
getEstimatedSize:
|
|
532
|
-
startIndexOverscan:
|
|
533
|
-
startIndexVisible:
|
|
534
|
-
scrollToIndex:
|
|
535
|
-
stopIndexOverscan:
|
|
536
|
-
stopIndexVisible:
|
|
537
|
-
} =
|
|
538
|
-
containerElement:
|
|
539
|
+
), [w, D] = H(null), I = me(w, f), {
|
|
540
|
+
getCellBounds: _,
|
|
541
|
+
getEstimatedSize: b,
|
|
542
|
+
startIndexOverscan: O,
|
|
543
|
+
startIndexVisible: V,
|
|
544
|
+
scrollToIndex: y,
|
|
545
|
+
stopIndexOverscan: S,
|
|
546
|
+
stopIndexVisible: q
|
|
547
|
+
} = ne({
|
|
548
|
+
containerElement: w,
|
|
539
549
|
containerStyle: g,
|
|
540
550
|
defaultContainerSize: c,
|
|
541
551
|
direction: "horizontal",
|
|
542
|
-
isRtl:
|
|
543
|
-
itemCount:
|
|
544
|
-
itemProps:
|
|
545
|
-
itemSize:
|
|
552
|
+
isRtl: I,
|
|
553
|
+
itemCount: n,
|
|
554
|
+
itemProps: E,
|
|
555
|
+
itemSize: l,
|
|
546
556
|
onResize: u,
|
|
547
|
-
overscanCount:
|
|
557
|
+
overscanCount: d
|
|
548
558
|
}), {
|
|
549
|
-
getCellBounds:
|
|
550
|
-
getEstimatedSize:
|
|
551
|
-
startIndexOverscan:
|
|
552
|
-
startIndexVisible:
|
|
553
|
-
scrollToIndex:
|
|
554
|
-
stopIndexOverscan:
|
|
555
|
-
stopIndexVisible:
|
|
556
|
-
} =
|
|
557
|
-
containerElement:
|
|
559
|
+
getCellBounds: A,
|
|
560
|
+
getEstimatedSize: T,
|
|
561
|
+
startIndexOverscan: R,
|
|
562
|
+
startIndexVisible: C,
|
|
563
|
+
scrollToIndex: te,
|
|
564
|
+
stopIndexOverscan: X,
|
|
565
|
+
stopIndexVisible: ce
|
|
566
|
+
} = ne({
|
|
567
|
+
containerElement: w,
|
|
558
568
|
containerStyle: g,
|
|
559
|
-
defaultContainerSize:
|
|
569
|
+
defaultContainerSize: a,
|
|
560
570
|
direction: "vertical",
|
|
561
|
-
itemCount:
|
|
562
|
-
itemProps:
|
|
563
|
-
itemSize:
|
|
571
|
+
itemCount: p,
|
|
572
|
+
itemProps: E,
|
|
573
|
+
itemSize: v,
|
|
564
574
|
onResize: u,
|
|
565
|
-
overscanCount:
|
|
575
|
+
overscanCount: d
|
|
566
576
|
});
|
|
567
|
-
|
|
568
|
-
|
|
577
|
+
he(
|
|
578
|
+
h,
|
|
569
579
|
() => ({
|
|
570
580
|
get element() {
|
|
571
|
-
return
|
|
581
|
+
return w;
|
|
572
582
|
},
|
|
573
583
|
scrollToCell({
|
|
574
|
-
behavior:
|
|
575
|
-
columnAlign:
|
|
576
|
-
columnIndex:
|
|
577
|
-
rowAlign:
|
|
584
|
+
behavior: j = "auto",
|
|
585
|
+
columnAlign: m = "auto",
|
|
586
|
+
columnIndex: B,
|
|
587
|
+
rowAlign: U = "auto",
|
|
578
588
|
rowIndex: k
|
|
579
589
|
}) {
|
|
580
|
-
const
|
|
581
|
-
align:
|
|
582
|
-
containerScrollOffset:
|
|
583
|
-
index:
|
|
584
|
-
}),
|
|
585
|
-
align:
|
|
586
|
-
containerScrollOffset:
|
|
590
|
+
const Z = y({
|
|
591
|
+
align: m,
|
|
592
|
+
containerScrollOffset: w?.scrollLeft ?? 0,
|
|
593
|
+
index: B
|
|
594
|
+
}), Ie = te({
|
|
595
|
+
align: U,
|
|
596
|
+
containerScrollOffset: w?.scrollTop ?? 0,
|
|
587
597
|
index: k
|
|
588
598
|
});
|
|
589
|
-
typeof
|
|
590
|
-
behavior:
|
|
591
|
-
left:
|
|
592
|
-
top:
|
|
599
|
+
typeof w?.scrollTo == "function" && w.scrollTo({
|
|
600
|
+
behavior: j,
|
|
601
|
+
left: Z,
|
|
602
|
+
top: Ie
|
|
593
603
|
});
|
|
594
604
|
},
|
|
595
605
|
scrollToColumn({
|
|
596
|
-
align:
|
|
597
|
-
behavior:
|
|
598
|
-
index:
|
|
606
|
+
align: j = "auto",
|
|
607
|
+
behavior: m = "auto",
|
|
608
|
+
index: B
|
|
599
609
|
}) {
|
|
600
|
-
const
|
|
601
|
-
align:
|
|
602
|
-
containerScrollOffset:
|
|
603
|
-
index:
|
|
610
|
+
const U = y({
|
|
611
|
+
align: j,
|
|
612
|
+
containerScrollOffset: w?.scrollLeft ?? 0,
|
|
613
|
+
index: B
|
|
604
614
|
});
|
|
605
|
-
typeof
|
|
606
|
-
behavior:
|
|
607
|
-
left:
|
|
615
|
+
typeof w?.scrollTo == "function" && w.scrollTo({
|
|
616
|
+
behavior: m,
|
|
617
|
+
left: U
|
|
608
618
|
});
|
|
609
619
|
},
|
|
610
620
|
scrollToRow({
|
|
611
|
-
align:
|
|
612
|
-
behavior:
|
|
613
|
-
index:
|
|
621
|
+
align: j = "auto",
|
|
622
|
+
behavior: m = "auto",
|
|
623
|
+
index: B
|
|
614
624
|
}) {
|
|
615
|
-
const
|
|
616
|
-
align:
|
|
617
|
-
containerScrollOffset:
|
|
618
|
-
index:
|
|
625
|
+
const U = te({
|
|
626
|
+
align: j,
|
|
627
|
+
containerScrollOffset: w?.scrollTop ?? 0,
|
|
628
|
+
index: B
|
|
619
629
|
});
|
|
620
|
-
typeof
|
|
621
|
-
behavior:
|
|
622
|
-
top:
|
|
630
|
+
typeof w?.scrollTo == "function" && w.scrollTo({
|
|
631
|
+
behavior: m,
|
|
632
|
+
top: U
|
|
623
633
|
});
|
|
624
634
|
}
|
|
625
635
|
}),
|
|
626
|
-
[
|
|
627
|
-
),
|
|
628
|
-
|
|
636
|
+
[w, y, te]
|
|
637
|
+
), ee(() => {
|
|
638
|
+
O >= 0 && S >= 0 && R >= 0 && X >= 0 && o && o(
|
|
629
639
|
{
|
|
630
|
-
columnStartIndex:
|
|
631
|
-
columnStopIndex:
|
|
632
|
-
rowStartIndex:
|
|
633
|
-
rowStopIndex:
|
|
640
|
+
columnStartIndex: V,
|
|
641
|
+
columnStopIndex: q,
|
|
642
|
+
rowStartIndex: C,
|
|
643
|
+
rowStopIndex: ce
|
|
634
644
|
},
|
|
635
645
|
{
|
|
636
|
-
columnStartIndex:
|
|
637
|
-
columnStopIndex:
|
|
638
|
-
rowStartIndex:
|
|
639
|
-
rowStopIndex:
|
|
646
|
+
columnStartIndex: O,
|
|
647
|
+
columnStopIndex: S,
|
|
648
|
+
rowStartIndex: R,
|
|
649
|
+
rowStopIndex: X
|
|
640
650
|
}
|
|
641
651
|
);
|
|
642
652
|
}, [
|
|
643
|
-
|
|
644
|
-
|
|
653
|
+
o,
|
|
654
|
+
O,
|
|
655
|
+
V,
|
|
656
|
+
S,
|
|
657
|
+
q,
|
|
645
658
|
R,
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
P,
|
|
650
|
-
J,
|
|
651
|
-
le
|
|
659
|
+
C,
|
|
660
|
+
X,
|
|
661
|
+
ce
|
|
652
662
|
]);
|
|
653
|
-
const
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
for (let
|
|
657
|
-
const
|
|
658
|
-
for (let k =
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
/* @__PURE__ */
|
|
663
|
+
const xe = W(() => {
|
|
664
|
+
const j = [];
|
|
665
|
+
if (n > 0 && p > 0)
|
|
666
|
+
for (let m = R; m <= X; m++) {
|
|
667
|
+
const B = A(m), U = [];
|
|
668
|
+
for (let k = O; k <= S; k++) {
|
|
669
|
+
const Z = _(k);
|
|
670
|
+
U.push(
|
|
671
|
+
/* @__PURE__ */ K(
|
|
662
672
|
F,
|
|
663
673
|
{
|
|
664
|
-
...
|
|
674
|
+
...E,
|
|
665
675
|
ariaAttributes: {
|
|
666
676
|
"aria-colindex": k + 1,
|
|
667
677
|
role: "gridcell"
|
|
668
678
|
},
|
|
669
679
|
columnIndex: k,
|
|
670
|
-
key:
|
|
680
|
+
key: i ? i({
|
|
671
681
|
columnIndex: k,
|
|
672
|
-
data:
|
|
673
|
-
rowIndex:
|
|
682
|
+
data: E,
|
|
683
|
+
rowIndex: m
|
|
674
684
|
}) : k,
|
|
675
|
-
rowIndex:
|
|
685
|
+
rowIndex: m,
|
|
676
686
|
style: {
|
|
677
687
|
position: "absolute",
|
|
678
|
-
left:
|
|
679
|
-
right:
|
|
680
|
-
transform: `translate(${
|
|
681
|
-
height:
|
|
682
|
-
width:
|
|
688
|
+
left: I ? void 0 : 0,
|
|
689
|
+
right: I ? 0 : void 0,
|
|
690
|
+
transform: `translate(${I ? -Z.scrollOffset : Z.scrollOffset}px, ${B.scrollOffset}px)`,
|
|
691
|
+
height: B.size,
|
|
692
|
+
width: Z.size
|
|
683
693
|
}
|
|
684
694
|
}
|
|
685
695
|
)
|
|
686
696
|
);
|
|
687
697
|
}
|
|
688
|
-
|
|
689
|
-
/* @__PURE__ */
|
|
698
|
+
j.push(
|
|
699
|
+
/* @__PURE__ */ re(
|
|
690
700
|
"div",
|
|
691
701
|
{
|
|
692
702
|
role: "row",
|
|
693
|
-
"aria-rowindex":
|
|
694
|
-
children:
|
|
703
|
+
"aria-rowindex": m + 1,
|
|
704
|
+
children: U
|
|
695
705
|
},
|
|
696
|
-
|
|
697
|
-
data:
|
|
698
|
-
rowIndex:
|
|
699
|
-
}) :
|
|
706
|
+
x ? x({
|
|
707
|
+
data: E,
|
|
708
|
+
rowIndex: m
|
|
709
|
+
}) : m
|
|
700
710
|
)
|
|
701
711
|
);
|
|
702
712
|
}
|
|
703
|
-
return
|
|
713
|
+
return j;
|
|
704
714
|
}, [
|
|
705
715
|
F,
|
|
706
|
-
|
|
707
|
-
o,
|
|
716
|
+
E,
|
|
708
717
|
n,
|
|
718
|
+
i,
|
|
719
|
+
O,
|
|
720
|
+
S,
|
|
721
|
+
_,
|
|
722
|
+
A,
|
|
709
723
|
I,
|
|
710
|
-
|
|
711
|
-
U,
|
|
712
|
-
E,
|
|
713
|
-
m,
|
|
724
|
+
p,
|
|
714
725
|
x,
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
]), ve = /* @__PURE__ */ oe(
|
|
726
|
+
R,
|
|
727
|
+
X
|
|
728
|
+
]), we = /* @__PURE__ */ re(
|
|
719
729
|
"div",
|
|
720
730
|
{
|
|
721
731
|
"aria-hidden": !0,
|
|
722
732
|
style: {
|
|
723
|
-
height:
|
|
724
|
-
width:
|
|
733
|
+
height: T(),
|
|
734
|
+
width: b(),
|
|
725
735
|
zIndex: -1
|
|
726
736
|
}
|
|
727
737
|
}
|
|
728
738
|
);
|
|
729
|
-
return
|
|
730
|
-
|
|
739
|
+
return K(
|
|
740
|
+
z,
|
|
731
741
|
{
|
|
732
|
-
"aria-colcount":
|
|
733
|
-
"aria-rowcount":
|
|
742
|
+
"aria-colcount": n,
|
|
743
|
+
"aria-rowcount": p,
|
|
734
744
|
role: "grid",
|
|
735
|
-
...
|
|
745
|
+
...M,
|
|
736
746
|
className: r,
|
|
737
747
|
dir: f,
|
|
738
|
-
ref:
|
|
748
|
+
ref: D,
|
|
739
749
|
style: {
|
|
740
750
|
position: "relative",
|
|
741
751
|
maxHeight: "100%",
|
|
@@ -745,68 +755,76 @@ function Le({
|
|
|
745
755
|
...g
|
|
746
756
|
}
|
|
747
757
|
},
|
|
748
|
-
|
|
758
|
+
xe,
|
|
749
759
|
s,
|
|
750
|
-
|
|
760
|
+
we
|
|
751
761
|
);
|
|
752
762
|
}
|
|
753
|
-
const
|
|
754
|
-
function
|
|
763
|
+
const $e = H, We = G;
|
|
764
|
+
function Ae(e) {
|
|
755
765
|
return e != null && typeof e == "object" && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
756
766
|
}
|
|
757
|
-
function
|
|
767
|
+
function Re({
|
|
758
768
|
element: e,
|
|
759
769
|
getCellBounds: t,
|
|
760
770
|
isDynamicRowHeight: s,
|
|
761
771
|
rowCount: r,
|
|
762
|
-
rowElements:
|
|
763
|
-
scrollToIndex:
|
|
772
|
+
rowElements: n,
|
|
773
|
+
scrollToIndex: i
|
|
764
774
|
}) {
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
l.current = void 0;
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
775
|
+
const l = G(null), a = G(
|
|
776
|
+
void 0
|
|
777
|
+
), c = J(() => {
|
|
778
|
+
l.current = null, a.current !== void 0 && (a.current.view.cancelAnimationFrame(a.current.id), a.current = void 0);
|
|
779
|
+
}), f = J(() => {
|
|
780
|
+
const o = ie(e);
|
|
781
|
+
a.current = {
|
|
782
|
+
id: o.requestAnimationFrame(h),
|
|
783
|
+
view: o
|
|
784
|
+
};
|
|
785
|
+
}), h = J(() => {
|
|
786
|
+
a.current = void 0;
|
|
787
|
+
const o = l.current;
|
|
788
|
+
if (!o) return;
|
|
789
|
+
if (!e || !s || o.index >= r || performance.now() >= o.deadline) {
|
|
772
790
|
c();
|
|
773
791
|
return;
|
|
774
792
|
}
|
|
775
|
-
const
|
|
776
|
-
align:
|
|
793
|
+
const u = i({
|
|
794
|
+
align: o.align,
|
|
777
795
|
containerScrollOffset: e.scrollTop,
|
|
778
|
-
index:
|
|
796
|
+
index: o.index
|
|
779
797
|
});
|
|
780
|
-
if (
|
|
781
|
-
const
|
|
798
|
+
if (u !== void 0) {
|
|
799
|
+
const d = Math.max(
|
|
782
800
|
0,
|
|
783
|
-
Math.min(
|
|
801
|
+
Math.min(u, e.scrollHeight - e.clientHeight)
|
|
784
802
|
);
|
|
785
|
-
if (Math.abs(
|
|
786
|
-
|
|
803
|
+
if (Math.abs(d - e.scrollTop) > 1)
|
|
804
|
+
o.stableFrames = 0, e.scrollTo({ behavior: "instant", top: d });
|
|
787
805
|
else {
|
|
788
|
-
const
|
|
789
|
-
if (!(
|
|
790
|
-
(
|
|
791
|
-
) &&
|
|
792
|
-
const
|
|
806
|
+
const p = n.current;
|
|
807
|
+
if (!(p.some(
|
|
808
|
+
(g) => g.getAttribute(Q) === `${o.index}`
|
|
809
|
+
) && p.every((g) => {
|
|
810
|
+
const z = Number(g.getAttribute(Q));
|
|
793
811
|
return Math.abs(
|
|
794
|
-
t(
|
|
812
|
+
t(z).size - g.offsetHeight
|
|
795
813
|
) <= 1;
|
|
796
814
|
})))
|
|
797
|
-
|
|
798
|
-
else if (++
|
|
815
|
+
o.stableFrames = 0;
|
|
816
|
+
else if (++o.stableFrames >= 2) {
|
|
799
817
|
c();
|
|
800
818
|
return;
|
|
801
819
|
}
|
|
802
820
|
}
|
|
803
821
|
}
|
|
804
|
-
|
|
822
|
+
f();
|
|
805
823
|
});
|
|
806
824
|
return Y(() => {
|
|
807
825
|
if (!e) return;
|
|
808
|
-
const
|
|
809
|
-
switch (
|
|
826
|
+
const o = (u) => {
|
|
827
|
+
switch (u.key) {
|
|
810
828
|
case "ArrowUp":
|
|
811
829
|
case "ArrowDown":
|
|
812
830
|
case "PageUp":
|
|
@@ -817,212 +835,219 @@ function Me({
|
|
|
817
835
|
c();
|
|
818
836
|
}
|
|
819
837
|
};
|
|
820
|
-
return e.addEventListener("wheel", c, { passive: !0 }), e.addEventListener("touchstart", c, { passive: !0 }), e.addEventListener("pointerdown", c), e.addEventListener("keydown",
|
|
821
|
-
c(), e.removeEventListener("wheel", c), e.removeEventListener("touchstart", c), e.removeEventListener("pointerdown", c), e.removeEventListener("keydown",
|
|
838
|
+
return e.addEventListener("wheel", c, { passive: !0 }), e.addEventListener("touchstart", c, { passive: !0 }), e.addEventListener("pointerdown", c), e.addEventListener("keydown", o), () => {
|
|
839
|
+
c(), e.removeEventListener("wheel", c), e.removeEventListener("touchstart", c), e.removeEventListener("pointerdown", c), e.removeEventListener("keydown", o);
|
|
822
840
|
};
|
|
823
841
|
}, [c, e]), $(
|
|
824
842
|
({
|
|
825
|
-
align:
|
|
826
|
-
behavior:
|
|
827
|
-
index:
|
|
843
|
+
align: o = "auto",
|
|
844
|
+
behavior: u = "auto",
|
|
845
|
+
index: d
|
|
828
846
|
}) => {
|
|
829
|
-
s &&
|
|
847
|
+
s && o === "smart" && (o = i({
|
|
830
848
|
align: "auto",
|
|
831
849
|
containerScrollOffset: e?.scrollTop ?? 0,
|
|
832
|
-
index:
|
|
850
|
+
index: d
|
|
833
851
|
}) === (e?.scrollTop ?? 0) ? "auto" : "center");
|
|
834
|
-
const
|
|
835
|
-
align:
|
|
852
|
+
const p = i({
|
|
853
|
+
align: o,
|
|
836
854
|
containerScrollOffset: e?.scrollTop ?? 0,
|
|
837
|
-
index:
|
|
855
|
+
index: d
|
|
838
856
|
});
|
|
839
|
-
c(), typeof e?.scrollTo == "function" && (s && (
|
|
840
|
-
align:
|
|
841
|
-
index:
|
|
857
|
+
c(), typeof e?.scrollTo == "function" && (s && (l.current = {
|
|
858
|
+
align: o,
|
|
859
|
+
index: d,
|
|
842
860
|
deadline: performance.now() + 1e3,
|
|
843
861
|
stableFrames: 0
|
|
844
|
-
},
|
|
845
|
-
behavior: s ? "instant" :
|
|
846
|
-
top:
|
|
862
|
+
}, f()), e.scrollTo({
|
|
863
|
+
behavior: s ? "instant" : u,
|
|
864
|
+
top: p
|
|
847
865
|
}));
|
|
848
866
|
},
|
|
849
|
-
[
|
|
867
|
+
[
|
|
868
|
+
c,
|
|
869
|
+
e,
|
|
870
|
+
s,
|
|
871
|
+
f,
|
|
872
|
+
i
|
|
873
|
+
]
|
|
850
874
|
);
|
|
851
875
|
}
|
|
852
|
-
const
|
|
853
|
-
function
|
|
876
|
+
const Q = "data-react-window-index", fe = "data-react-window-sizer";
|
|
877
|
+
function He({
|
|
854
878
|
children: e,
|
|
855
879
|
className: t,
|
|
856
880
|
defaultHeight: s = 0,
|
|
857
881
|
listRef: r,
|
|
858
|
-
onResize:
|
|
859
|
-
onRowsRendered:
|
|
860
|
-
overscanCount:
|
|
861
|
-
rowComponent:
|
|
882
|
+
onResize: n,
|
|
883
|
+
onRowsRendered: i,
|
|
884
|
+
overscanCount: l = 3,
|
|
885
|
+
rowComponent: a,
|
|
862
886
|
rowCount: c,
|
|
863
887
|
rowHeight: f,
|
|
864
|
-
rowKey:
|
|
865
|
-
rowProps:
|
|
888
|
+
rowKey: h,
|
|
889
|
+
rowProps: o,
|
|
866
890
|
tagName: u = "div",
|
|
867
|
-
style:
|
|
868
|
-
...
|
|
891
|
+
style: d,
|
|
892
|
+
...p
|
|
869
893
|
}) {
|
|
870
|
-
const
|
|
871
|
-
() =>
|
|
872
|
-
[
|
|
873
|
-
), [g,
|
|
894
|
+
const v = ge(o), x = W(
|
|
895
|
+
() => ue(a, be),
|
|
896
|
+
[a]
|
|
897
|
+
), [g, z] = H(null), M = Ae(f), E = W(() => M ? (A) => f.getRowHeight(A) ?? f.getAverageRowHeight() : f, [M, f]), {
|
|
874
898
|
getCellBounds: F,
|
|
875
|
-
getEstimatedSize:
|
|
876
|
-
scrollToIndex:
|
|
877
|
-
startIndexOverscan:
|
|
878
|
-
startIndexVisible:
|
|
879
|
-
stopIndexOverscan:
|
|
880
|
-
stopIndexVisible:
|
|
881
|
-
} =
|
|
899
|
+
getEstimatedSize: w,
|
|
900
|
+
scrollToIndex: D,
|
|
901
|
+
startIndexOverscan: I,
|
|
902
|
+
startIndexVisible: _,
|
|
903
|
+
stopIndexOverscan: b,
|
|
904
|
+
stopIndexVisible: O
|
|
905
|
+
} = ne({
|
|
882
906
|
containerElement: g,
|
|
883
|
-
containerStyle:
|
|
907
|
+
containerStyle: d,
|
|
884
908
|
defaultContainerSize: s,
|
|
885
909
|
direction: "vertical",
|
|
886
910
|
itemCount: c,
|
|
887
|
-
itemProps:
|
|
888
|
-
itemSize:
|
|
889
|
-
onResize:
|
|
890
|
-
overscanCount:
|
|
891
|
-
}),
|
|
911
|
+
itemProps: v,
|
|
912
|
+
itemSize: E,
|
|
913
|
+
onResize: n,
|
|
914
|
+
overscanCount: l
|
|
915
|
+
}), V = G([]), y = Re({
|
|
892
916
|
element: g,
|
|
893
917
|
getCellBounds: F,
|
|
894
|
-
isDynamicRowHeight:
|
|
918
|
+
isDynamicRowHeight: M,
|
|
895
919
|
rowCount: c,
|
|
896
|
-
rowElements:
|
|
897
|
-
scrollToIndex:
|
|
920
|
+
rowElements: V,
|
|
921
|
+
scrollToIndex: D
|
|
898
922
|
});
|
|
899
|
-
|
|
923
|
+
he(
|
|
900
924
|
r,
|
|
901
925
|
() => ({
|
|
902
926
|
get element() {
|
|
903
927
|
return g;
|
|
904
928
|
},
|
|
905
|
-
scrollToRow:
|
|
929
|
+
scrollToRow: y
|
|
906
930
|
}),
|
|
907
|
-
[g,
|
|
931
|
+
[g, y]
|
|
908
932
|
), Y(() => {
|
|
909
933
|
if (!g)
|
|
910
934
|
return;
|
|
911
|
-
const
|
|
935
|
+
const A = Array.from(g.children).slice(
|
|
912
936
|
0,
|
|
913
|
-
|
|
914
|
-
).filter((
|
|
915
|
-
if (
|
|
937
|
+
I < 0 ? 0 : b - I + 1
|
|
938
|
+
).filter((T, R) => {
|
|
939
|
+
if (T.hasAttribute(fe))
|
|
916
940
|
return !1;
|
|
917
|
-
const
|
|
918
|
-
return
|
|
941
|
+
const C = `${I + R}`;
|
|
942
|
+
return T.setAttribute(Q, C), !0;
|
|
919
943
|
});
|
|
920
|
-
if (
|
|
921
|
-
return f.observeRowElements(
|
|
944
|
+
if (V.current = A, M)
|
|
945
|
+
return f.observeRowElements(A);
|
|
922
946
|
}, [
|
|
923
|
-
|
|
947
|
+
x,
|
|
924
948
|
g,
|
|
925
|
-
|
|
949
|
+
M,
|
|
926
950
|
c,
|
|
927
951
|
f,
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
]),
|
|
933
|
-
|
|
952
|
+
h,
|
|
953
|
+
v,
|
|
954
|
+
I,
|
|
955
|
+
b
|
|
956
|
+
]), ee(() => {
|
|
957
|
+
I >= 0 && b >= 0 && i && i(
|
|
934
958
|
{
|
|
935
|
-
startIndex:
|
|
936
|
-
stopIndex:
|
|
959
|
+
startIndex: _,
|
|
960
|
+
stopIndex: O
|
|
937
961
|
},
|
|
938
962
|
{
|
|
939
|
-
startIndex:
|
|
940
|
-
stopIndex:
|
|
963
|
+
startIndex: I,
|
|
964
|
+
stopIndex: b
|
|
941
965
|
}
|
|
942
966
|
);
|
|
943
967
|
}, [
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
968
|
+
i,
|
|
969
|
+
I,
|
|
970
|
+
_,
|
|
971
|
+
b,
|
|
972
|
+
O
|
|
949
973
|
]);
|
|
950
|
-
const
|
|
951
|
-
const
|
|
974
|
+
const S = W(() => {
|
|
975
|
+
const A = [];
|
|
952
976
|
if (c > 0)
|
|
953
|
-
for (let
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
|
|
977
|
+
for (let T = I; T <= b; T++) {
|
|
978
|
+
const R = F(T);
|
|
979
|
+
A.push(
|
|
980
|
+
/* @__PURE__ */ K(
|
|
981
|
+
x,
|
|
958
982
|
{
|
|
959
|
-
...
|
|
983
|
+
...v,
|
|
960
984
|
ariaAttributes: {
|
|
961
|
-
"aria-posinset":
|
|
985
|
+
"aria-posinset": T + 1,
|
|
962
986
|
"aria-setsize": c,
|
|
963
987
|
role: "listitem"
|
|
964
988
|
},
|
|
965
|
-
key:
|
|
966
|
-
index:
|
|
989
|
+
key: h ? h(T, v) : T,
|
|
990
|
+
index: T,
|
|
967
991
|
style: {
|
|
968
992
|
position: "absolute",
|
|
969
993
|
left: 0,
|
|
970
|
-
transform: `translateY(${
|
|
994
|
+
transform: `translateY(${R.scrollOffset}px)`,
|
|
971
995
|
// In case of dynamic row heights, don't specify a height style
|
|
972
996
|
// otherwise a default/estimated height would mask the actual height
|
|
973
|
-
height:
|
|
997
|
+
height: M ? void 0 : R.size,
|
|
974
998
|
width: "100%"
|
|
975
999
|
}
|
|
976
1000
|
}
|
|
977
1001
|
)
|
|
978
1002
|
);
|
|
979
1003
|
}
|
|
980
|
-
return
|
|
1004
|
+
return A;
|
|
981
1005
|
}, [
|
|
982
|
-
|
|
1006
|
+
x,
|
|
983
1007
|
F,
|
|
984
|
-
|
|
1008
|
+
M,
|
|
985
1009
|
c,
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
]),
|
|
1010
|
+
h,
|
|
1011
|
+
v,
|
|
1012
|
+
I,
|
|
1013
|
+
b
|
|
1014
|
+
]), q = /* @__PURE__ */ re(
|
|
991
1015
|
"div",
|
|
992
1016
|
{
|
|
993
1017
|
"aria-hidden": !0,
|
|
1018
|
+
[fe]: "",
|
|
994
1019
|
style: {
|
|
995
|
-
height:
|
|
1020
|
+
height: w(),
|
|
996
1021
|
width: "100%",
|
|
997
1022
|
zIndex: -1
|
|
998
1023
|
}
|
|
999
1024
|
}
|
|
1000
1025
|
);
|
|
1001
|
-
return
|
|
1026
|
+
return K(
|
|
1002
1027
|
u,
|
|
1003
1028
|
{
|
|
1004
1029
|
role: "list",
|
|
1005
|
-
...
|
|
1030
|
+
...p,
|
|
1006
1031
|
className: t,
|
|
1007
|
-
ref:
|
|
1032
|
+
ref: z,
|
|
1008
1033
|
style: {
|
|
1009
1034
|
position: "relative",
|
|
1010
1035
|
maxHeight: "100%",
|
|
1011
1036
|
flexGrow: 1,
|
|
1012
1037
|
overflowY: "auto",
|
|
1013
|
-
...
|
|
1038
|
+
...d
|
|
1014
1039
|
}
|
|
1015
1040
|
},
|
|
1016
|
-
|
|
1041
|
+
S,
|
|
1017
1042
|
e,
|
|
1018
|
-
|
|
1043
|
+
q
|
|
1019
1044
|
);
|
|
1020
1045
|
}
|
|
1021
|
-
function
|
|
1046
|
+
function Fe({
|
|
1022
1047
|
defaultRowHeight: e,
|
|
1023
1048
|
key: t
|
|
1024
1049
|
}) {
|
|
1025
|
-
const [s, r] =
|
|
1050
|
+
const [s, r] = H({
|
|
1026
1051
|
key: t,
|
|
1027
1052
|
map: /* @__PURE__ */ new Map()
|
|
1028
1053
|
});
|
|
@@ -1030,83 +1055,96 @@ function $e({
|
|
|
1030
1055
|
key: t,
|
|
1031
1056
|
map: /* @__PURE__ */ new Map()
|
|
1032
1057
|
});
|
|
1033
|
-
const { map:
|
|
1034
|
-
let
|
|
1035
|
-
return
|
|
1036
|
-
|
|
1037
|
-
}),
|
|
1038
|
-
}, [e,
|
|
1039
|
-
(
|
|
1040
|
-
const u =
|
|
1058
|
+
const { map: n } = s, i = $(() => {
|
|
1059
|
+
let o = 0;
|
|
1060
|
+
return n.forEach((u) => {
|
|
1061
|
+
o += u;
|
|
1062
|
+
}), o === 0 ? e : o / n.size;
|
|
1063
|
+
}, [e, n]), l = $(
|
|
1064
|
+
(o) => {
|
|
1065
|
+
const u = n.get(o);
|
|
1041
1066
|
return u !== void 0 ? u : e;
|
|
1042
1067
|
},
|
|
1043
|
-
[e,
|
|
1044
|
-
),
|
|
1045
|
-
r((
|
|
1046
|
-
if (
|
|
1047
|
-
return
|
|
1048
|
-
const
|
|
1049
|
-
return
|
|
1050
|
-
...
|
|
1051
|
-
map:
|
|
1068
|
+
[e, n]
|
|
1069
|
+
), a = $((o, u) => {
|
|
1070
|
+
r((d) => {
|
|
1071
|
+
if (d.map.get(o) === u)
|
|
1072
|
+
return d;
|
|
1073
|
+
const p = new Map(d.map);
|
|
1074
|
+
return p.set(o, u), {
|
|
1075
|
+
...d,
|
|
1076
|
+
map: p
|
|
1052
1077
|
};
|
|
1053
1078
|
});
|
|
1054
|
-
}, []), c =
|
|
1055
|
-
(
|
|
1056
|
-
|
|
1057
|
-
const { borderBoxSize:
|
|
1079
|
+
}, []), c = J(
|
|
1080
|
+
(o) => {
|
|
1081
|
+
o.length !== 0 && o.forEach((u) => {
|
|
1082
|
+
const { borderBoxSize: d, target: p } = u, v = p.getAttribute(Q);
|
|
1058
1083
|
L(
|
|
1059
|
-
|
|
1060
|
-
`Invalid ${
|
|
1084
|
+
v !== null,
|
|
1085
|
+
`Invalid ${Q} attribute value`
|
|
1061
1086
|
);
|
|
1062
|
-
const
|
|
1063
|
-
g &&
|
|
1087
|
+
const x = parseInt(v), { blockSize: g } = d[0];
|
|
1088
|
+
g && a(x, g);
|
|
1064
1089
|
});
|
|
1065
1090
|
}
|
|
1066
|
-
),
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1091
|
+
), f = G(null);
|
|
1092
|
+
ee(
|
|
1093
|
+
() => () => {
|
|
1094
|
+
f.current?.resizeObserver.disconnect(), f.current = null;
|
|
1095
|
+
},
|
|
1096
|
+
[]
|
|
1097
|
+
);
|
|
1098
|
+
const h = $(
|
|
1099
|
+
(o) => {
|
|
1100
|
+
const u = [];
|
|
1101
|
+
return o.forEach((d) => {
|
|
1102
|
+
const p = ie(d);
|
|
1103
|
+
if (f.current?.view !== p) {
|
|
1104
|
+
f.current?.resizeObserver.disconnect();
|
|
1105
|
+
const x = ve(d);
|
|
1106
|
+
f.current = x ? {
|
|
1107
|
+
resizeObserver: new x(c),
|
|
1108
|
+
view: p
|
|
1109
|
+
} : null;
|
|
1110
|
+
}
|
|
1111
|
+
const v = f.current?.resizeObserver;
|
|
1112
|
+
v && (v.observe(d), u.push([d, v]));
|
|
1113
|
+
}), () => {
|
|
1114
|
+
u.forEach(
|
|
1115
|
+
([d, p]) => p.unobserve(d)
|
|
1116
|
+
);
|
|
1074
1117
|
};
|
|
1075
|
-
}, [f]);
|
|
1076
|
-
const i = $(
|
|
1077
|
-
(d) => f ? (d.forEach((u) => f.observe(u)), () => {
|
|
1078
|
-
d.forEach((u) => f.unobserve(u));
|
|
1079
|
-
}) : () => {
|
|
1080
1118
|
},
|
|
1081
|
-
[
|
|
1119
|
+
[c]
|
|
1082
1120
|
);
|
|
1083
|
-
return
|
|
1121
|
+
return W(
|
|
1084
1122
|
() => ({
|
|
1085
|
-
getAverageRowHeight:
|
|
1086
|
-
getRowHeight:
|
|
1087
|
-
setRowHeight:
|
|
1088
|
-
observeRowElements:
|
|
1123
|
+
getAverageRowHeight: i,
|
|
1124
|
+
getRowHeight: l,
|
|
1125
|
+
setRowHeight: a,
|
|
1126
|
+
observeRowElements: h
|
|
1089
1127
|
}),
|
|
1090
|
-
[
|
|
1128
|
+
[i, l, a, h]
|
|
1091
1129
|
);
|
|
1092
1130
|
}
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
if (
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1131
|
+
const je = H, Be = G, de = /* @__PURE__ */ new WeakMap();
|
|
1132
|
+
function Ue(e = !1, t = document) {
|
|
1133
|
+
let s = de.get(t);
|
|
1134
|
+
if (s === void 0 || e) {
|
|
1135
|
+
const r = t.createElement("div"), n = r.style;
|
|
1136
|
+
n.width = "50px", n.height = "50px", n.overflow = "scroll", t.body.appendChild(r), s = r.offsetWidth - r.clientWidth, t.body.removeChild(r), de.set(t, s);
|
|
1099
1137
|
}
|
|
1100
|
-
return
|
|
1138
|
+
return s;
|
|
1101
1139
|
}
|
|
1102
1140
|
export {
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1141
|
+
ke as Grid,
|
|
1142
|
+
He as List,
|
|
1143
|
+
Ue as getScrollbarSize,
|
|
1144
|
+
Fe as useDynamicRowHeight,
|
|
1145
|
+
$e as useGridCallbackRef,
|
|
1146
|
+
We as useGridRef,
|
|
1147
|
+
je as useListCallbackRef,
|
|
1148
|
+
Be as useListRef
|
|
1111
1149
|
};
|
|
1112
1150
|
//# sourceMappingURL=react-window.js.map
|