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