react-window 2.0.0-alpha.1 → 2.0.0-alpha.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.d.ts +20 -5
- package/dist/react-window.js +291 -285
- package/docs/assets/{index-B8YZlUKM.js → index-BPRxcSBS.js} +16 -16
- package/docs/generated/code-snippets/CellComponent.json +1 -1
- package/docs/generated/code-snippets/useGridCallbackRef.json +4 -0
- package/docs/generated/code-snippets/useListCallbackRef.json +4 -0
- package/docs/generated/js-docs/Grid.json +1 -1
- package/docs/index.html +1 -1
- package/docs/stats.html +1 -1
- package/package.json +1 -1
package/dist/react-window.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as j } from "react/jsx-runtime";
|
|
2
|
-
import { useLayoutEffect as J, useEffect as
|
|
3
|
-
|
|
2
|
+
import { useLayoutEffect as J, useEffect as P, useMemo as M, useState as $, useCallback as R, memo as V, useImperativeHandle as U, createElement as F, useRef as Y } from "react";
|
|
3
|
+
const q = typeof window < "u" ? J : P;
|
|
4
|
+
function W(t) {
|
|
4
5
|
if (t !== void 0)
|
|
5
6
|
switch (typeof t) {
|
|
6
7
|
case "number":
|
|
@@ -12,63 +13,62 @@ function B(t) {
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
const q = typeof window < "u" ? J : W;
|
|
16
16
|
function K({
|
|
17
17
|
box: t,
|
|
18
18
|
defaultHeight: r,
|
|
19
|
-
defaultWidth:
|
|
19
|
+
defaultWidth: l,
|
|
20
20
|
disabled: s,
|
|
21
21
|
element: e,
|
|
22
|
-
mode:
|
|
23
|
-
style:
|
|
22
|
+
mode: i,
|
|
23
|
+
style: n
|
|
24
24
|
}) {
|
|
25
|
-
const { styleHeight:
|
|
25
|
+
const { styleHeight: c, styleWidth: o } = M(
|
|
26
26
|
() => ({
|
|
27
|
-
styleHeight:
|
|
28
|
-
styleWidth:
|
|
27
|
+
styleHeight: W(n?.height),
|
|
28
|
+
styleWidth: W(n?.width)
|
|
29
29
|
}),
|
|
30
|
-
[
|
|
31
|
-
), [
|
|
30
|
+
[n?.height, n?.width]
|
|
31
|
+
), [f, p] = $({
|
|
32
32
|
height: r,
|
|
33
|
-
width:
|
|
34
|
-
}),
|
|
33
|
+
width: l
|
|
34
|
+
}), I = s || i === "only-height" && c !== void 0 || i === "only-width" && o !== void 0 || c !== void 0 && o !== void 0;
|
|
35
35
|
return q(() => {
|
|
36
|
-
if (e === null ||
|
|
36
|
+
if (e === null || I)
|
|
37
37
|
return;
|
|
38
|
-
const b = new ResizeObserver((
|
|
39
|
-
for (const
|
|
40
|
-
const { contentRect:
|
|
41
|
-
e ===
|
|
42
|
-
height:
|
|
43
|
-
width:
|
|
38
|
+
const b = new ResizeObserver((y) => {
|
|
39
|
+
for (const w of y) {
|
|
40
|
+
const { contentRect: d, target: x } = w;
|
|
41
|
+
e === x && p((z) => z.height === d.height && z.width === d.width ? z : {
|
|
42
|
+
height: d.height,
|
|
43
|
+
width: d.width
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
return b.observe(e, { box: t }), () => {
|
|
48
48
|
b?.unobserve(e);
|
|
49
49
|
};
|
|
50
|
-
}, [t,
|
|
50
|
+
}, [t, I, e, c, o]), M(
|
|
51
51
|
() => ({
|
|
52
|
-
height:
|
|
53
|
-
width: o ??
|
|
52
|
+
height: c ?? f.height,
|
|
53
|
+
width: o ?? f.width
|
|
54
54
|
}),
|
|
55
|
-
[
|
|
55
|
+
[f, c, o]
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function E(t, r = "Assertion error") {
|
|
59
59
|
if (!t)
|
|
60
60
|
throw console.error(r), Error(r);
|
|
61
61
|
}
|
|
62
62
|
function Q({
|
|
63
63
|
cachedBounds: t,
|
|
64
64
|
itemCount: r,
|
|
65
|
-
itemSize:
|
|
65
|
+
itemSize: l
|
|
66
66
|
}) {
|
|
67
|
-
if (typeof
|
|
68
|
-
return r *
|
|
67
|
+
if (typeof l == "number")
|
|
68
|
+
return r * l;
|
|
69
69
|
if (t.size > 0) {
|
|
70
70
|
const s = t.get(t.size - 1);
|
|
71
|
-
|
|
71
|
+
E(s !== void 0, "Unexpected bounds cache miss");
|
|
72
72
|
const e = (s.scrollOffset + s.size) / t.size;
|
|
73
73
|
return r * e;
|
|
74
74
|
} else
|
|
@@ -77,91 +77,91 @@ function Q({
|
|
|
77
77
|
function X({
|
|
78
78
|
align: t,
|
|
79
79
|
cachedBounds: r,
|
|
80
|
-
index:
|
|
80
|
+
index: l,
|
|
81
81
|
itemCount: s,
|
|
82
82
|
containerScrollOffset: e,
|
|
83
|
-
containerSize:
|
|
83
|
+
containerSize: i
|
|
84
84
|
}) {
|
|
85
|
-
const
|
|
85
|
+
const n = r.get(s - 1).scrollOffset, c = n + n - i, o = Math.max(
|
|
86
86
|
0,
|
|
87
|
-
r.get(
|
|
88
|
-
),
|
|
89
|
-
|
|
90
|
-
r.get(
|
|
87
|
+
r.get(l + 1).scrollOffset - i
|
|
88
|
+
), f = Math.min(
|
|
89
|
+
n,
|
|
90
|
+
r.get(l).scrollOffset
|
|
91
91
|
);
|
|
92
|
-
switch (t === "smart" && (e >= o && e <=
|
|
92
|
+
switch (t === "smart" && (e >= o && e <= f ? t = "auto" : t = "center"), t) {
|
|
93
93
|
case "start":
|
|
94
|
-
return Math.min(
|
|
94
|
+
return Math.min(c, f);
|
|
95
95
|
case "end":
|
|
96
96
|
return o;
|
|
97
97
|
case "center": {
|
|
98
|
-
const
|
|
99
|
-
o + (
|
|
98
|
+
const p = Math.round(
|
|
99
|
+
o + (f - o) / 2
|
|
100
100
|
);
|
|
101
|
-
return
|
|
101
|
+
return p < Math.ceil(i / 2) ? 0 : p > c ? c : p;
|
|
102
102
|
}
|
|
103
103
|
case "auto":
|
|
104
104
|
default:
|
|
105
|
-
return e >= o && e <=
|
|
105
|
+
return e >= o && e <= f ? e : e < o ? o : f;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
function Z({
|
|
109
109
|
cachedBounds: t,
|
|
110
110
|
containerScrollOffset: r,
|
|
111
|
-
containerSize:
|
|
111
|
+
containerSize: l,
|
|
112
112
|
itemCount: s,
|
|
113
113
|
overscanCount: e
|
|
114
114
|
}) {
|
|
115
|
-
const
|
|
116
|
-
let
|
|
117
|
-
for (; o <
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
115
|
+
const i = s - 1;
|
|
116
|
+
let n = 0, c = -1, o = 0;
|
|
117
|
+
for (; o < i; ) {
|
|
118
|
+
const f = t.get(o);
|
|
119
|
+
if (f.scrollOffset + f.size > r)
|
|
120
120
|
break;
|
|
121
121
|
o++;
|
|
122
122
|
}
|
|
123
|
-
for (
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
123
|
+
for (n = o, n = Math.max(0, n - e); o < i; ) {
|
|
124
|
+
const f = t.get(o);
|
|
125
|
+
if (f.scrollOffset + f.size >= r + l)
|
|
126
126
|
break;
|
|
127
127
|
o++;
|
|
128
128
|
}
|
|
129
|
-
return
|
|
129
|
+
return c = Math.min(i, o), c = Math.min(s - 1, c + e), n < 0 ? [0, -1] : [n, c];
|
|
130
130
|
}
|
|
131
131
|
function _({
|
|
132
132
|
itemCount: t,
|
|
133
133
|
itemProps: r,
|
|
134
|
-
itemSize:
|
|
134
|
+
itemSize: l
|
|
135
135
|
}) {
|
|
136
136
|
const s = /* @__PURE__ */ new Map();
|
|
137
137
|
return {
|
|
138
138
|
get(e) {
|
|
139
|
-
for (
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
s.set(
|
|
143
|
-
size:
|
|
139
|
+
for (E(e < t, `Invalid index ${e}`); s.size - 1 < e; ) {
|
|
140
|
+
const n = s.size, c = typeof l == "number" ? l : l(n, r);
|
|
141
|
+
if (n === 0)
|
|
142
|
+
s.set(n, {
|
|
143
|
+
size: c,
|
|
144
144
|
scrollOffset: 0
|
|
145
145
|
});
|
|
146
146
|
else {
|
|
147
|
-
const o = s.get(
|
|
148
|
-
|
|
147
|
+
const o = s.get(n - 1);
|
|
148
|
+
E(
|
|
149
149
|
o !== void 0,
|
|
150
150
|
`Unexpected bounds cache miss for index ${e}`
|
|
151
|
-
), s.set(
|
|
151
|
+
), s.set(n, {
|
|
152
152
|
scrollOffset: o.scrollOffset + o.size,
|
|
153
|
-
size:
|
|
153
|
+
size: c
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
return
|
|
159
|
-
|
|
157
|
+
const i = s.get(e);
|
|
158
|
+
return E(
|
|
159
|
+
i !== void 0,
|
|
160
160
|
`Unexpected bounds cache miss for index ${e}`
|
|
161
|
-
),
|
|
161
|
+
), i;
|
|
162
162
|
},
|
|
163
|
-
set(e,
|
|
164
|
-
s.set(e,
|
|
163
|
+
set(e, i) {
|
|
164
|
+
s.set(e, i);
|
|
165
165
|
},
|
|
166
166
|
get size() {
|
|
167
167
|
return s.size;
|
|
@@ -171,267 +171,271 @@ function _({
|
|
|
171
171
|
function N({
|
|
172
172
|
itemCount: t,
|
|
173
173
|
itemProps: r,
|
|
174
|
-
itemSize:
|
|
174
|
+
itemSize: l
|
|
175
175
|
}) {
|
|
176
|
-
return
|
|
176
|
+
return M(
|
|
177
177
|
() => _({
|
|
178
178
|
itemCount: t,
|
|
179
179
|
itemProps: r,
|
|
180
|
-
itemSize:
|
|
180
|
+
itemSize: l
|
|
181
181
|
}),
|
|
182
|
-
[t, r,
|
|
182
|
+
[t, r, l]
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function G({
|
|
186
186
|
containerElement: t,
|
|
187
187
|
containerStyle: r,
|
|
188
|
-
defaultContainerSize:
|
|
188
|
+
defaultContainerSize: l = 0,
|
|
189
189
|
direction: s,
|
|
190
190
|
itemCount: e,
|
|
191
|
-
itemProps:
|
|
192
|
-
itemSize:
|
|
193
|
-
overscanCount:
|
|
191
|
+
itemProps: i,
|
|
192
|
+
itemSize: n,
|
|
193
|
+
overscanCount: c
|
|
194
194
|
}) {
|
|
195
|
-
const [
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
const [o, f] = $([0, -1]), [p, I] = [
|
|
196
|
+
Math.min(e - 1, o[0]),
|
|
197
|
+
Math.min(e - 1, o[1])
|
|
198
|
+
], { height: b = l, width: y = l } = K({
|
|
199
|
+
defaultHeight: s === "vertical" ? l : void 0,
|
|
200
|
+
defaultWidth: s === "horizontal" ? l : void 0,
|
|
198
201
|
element: t,
|
|
199
202
|
mode: s === "vertical" ? "only-height" : "only-width",
|
|
200
203
|
style: r
|
|
201
|
-
}),
|
|
204
|
+
}), w = s === "vertical" ? b : y, d = N({
|
|
202
205
|
itemCount: e,
|
|
203
|
-
itemProps:
|
|
204
|
-
itemSize:
|
|
205
|
-
}),
|
|
206
|
-
(
|
|
206
|
+
itemProps: i,
|
|
207
|
+
itemSize: n
|
|
208
|
+
}), x = R(
|
|
209
|
+
(u) => d.get(u),
|
|
207
210
|
[d]
|
|
208
|
-
),
|
|
211
|
+
), z = R(
|
|
209
212
|
() => Q({
|
|
210
213
|
cachedBounds: d,
|
|
211
214
|
itemCount: e,
|
|
212
|
-
itemSize:
|
|
215
|
+
itemSize: n
|
|
213
216
|
}),
|
|
214
|
-
[d, e,
|
|
215
|
-
),
|
|
216
|
-
(
|
|
217
|
+
[d, e, n]
|
|
218
|
+
), h = R(
|
|
219
|
+
(u) => Z({
|
|
217
220
|
cachedBounds: d,
|
|
218
|
-
containerScrollOffset:
|
|
219
|
-
containerSize:
|
|
221
|
+
containerScrollOffset: u,
|
|
222
|
+
containerSize: w,
|
|
220
223
|
itemCount: e,
|
|
221
|
-
overscanCount:
|
|
224
|
+
overscanCount: c
|
|
222
225
|
}),
|
|
223
|
-
[d,
|
|
226
|
+
[d, w, e, c]
|
|
224
227
|
);
|
|
225
228
|
q(() => {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
+
const u = (s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0;
|
|
230
|
+
f(h(u));
|
|
231
|
+
}, [t, s, h]);
|
|
232
|
+
const a = R(
|
|
229
233
|
({
|
|
230
|
-
align:
|
|
231
|
-
behavior:
|
|
232
|
-
containerScrollOffset:
|
|
233
|
-
index:
|
|
234
|
+
align: u = "auto",
|
|
235
|
+
behavior: O = "auto",
|
|
236
|
+
containerScrollOffset: m,
|
|
237
|
+
index: g
|
|
234
238
|
}) => {
|
|
235
|
-
const
|
|
236
|
-
align:
|
|
239
|
+
const S = X({
|
|
240
|
+
align: u,
|
|
237
241
|
cachedBounds: d,
|
|
238
|
-
containerScrollOffset:
|
|
239
|
-
containerSize:
|
|
240
|
-
index:
|
|
242
|
+
containerScrollOffset: m,
|
|
243
|
+
containerSize: w,
|
|
244
|
+
index: g,
|
|
241
245
|
itemCount: e
|
|
242
246
|
});
|
|
243
247
|
s === "horizontal" ? t?.scrollTo({
|
|
244
|
-
left:
|
|
245
|
-
behavior:
|
|
248
|
+
left: S,
|
|
249
|
+
behavior: O || void 0
|
|
246
250
|
}) : t?.scrollTo({
|
|
247
|
-
behavior:
|
|
248
|
-
top:
|
|
251
|
+
behavior: O || void 0,
|
|
252
|
+
top: S
|
|
249
253
|
});
|
|
250
254
|
},
|
|
251
|
-
[d, t,
|
|
255
|
+
[d, t, w, s, e]
|
|
252
256
|
);
|
|
253
257
|
return {
|
|
254
|
-
getCellBounds:
|
|
255
|
-
getEstimatedHeight:
|
|
258
|
+
getCellBounds: x,
|
|
259
|
+
getEstimatedHeight: z,
|
|
256
260
|
onScroll: () => {
|
|
257
|
-
const
|
|
261
|
+
const u = h(
|
|
258
262
|
(s === "vertical" ? t?.scrollTop : t?.scrollLeft) ?? 0
|
|
259
263
|
);
|
|
260
|
-
(
|
|
264
|
+
(u[0] !== p || u[1] !== I) && f(u);
|
|
261
265
|
},
|
|
262
|
-
scrollToIndex:
|
|
263
|
-
startIndex:
|
|
264
|
-
stopIndex:
|
|
266
|
+
scrollToIndex: a,
|
|
267
|
+
startIndex: p,
|
|
268
|
+
stopIndex: I
|
|
265
269
|
};
|
|
266
270
|
}
|
|
267
271
|
function A(t) {
|
|
268
|
-
return
|
|
272
|
+
return M(() => t, Object.values(t));
|
|
269
273
|
}
|
|
270
|
-
function
|
|
274
|
+
function B(t, r) {
|
|
271
275
|
if (t === r)
|
|
272
276
|
return !0;
|
|
273
|
-
if (!!t != !!r || (
|
|
277
|
+
if (!!t != !!r || (E(t !== void 0), E(r !== void 0), Object.keys(t).length !== Object.keys(r).length))
|
|
274
278
|
return !1;
|
|
275
|
-
for (const
|
|
276
|
-
if (!Object.is(r[
|
|
279
|
+
for (const l in t)
|
|
280
|
+
if (!Object.is(r[l], t[l]))
|
|
277
281
|
return !1;
|
|
278
282
|
return !0;
|
|
279
283
|
}
|
|
280
284
|
function D(t, r) {
|
|
281
|
-
const { style:
|
|
282
|
-
return
|
|
285
|
+
const { style: l, ...s } = t, { style: e, ...i } = r;
|
|
286
|
+
return B(l, e) && B(s, i);
|
|
283
287
|
}
|
|
284
288
|
function et({
|
|
285
289
|
cellComponent: t,
|
|
286
290
|
cellProps: r,
|
|
287
|
-
className:
|
|
291
|
+
className: l,
|
|
288
292
|
columnCount: s,
|
|
289
293
|
columnWidth: e,
|
|
290
|
-
defaultHeight:
|
|
291
|
-
defaultWidth:
|
|
292
|
-
gridRef:
|
|
294
|
+
defaultHeight: i = 0,
|
|
295
|
+
defaultWidth: n = 0,
|
|
296
|
+
gridRef: c,
|
|
293
297
|
onCellsRendered: o,
|
|
294
|
-
overscanCount:
|
|
295
|
-
rowCount:
|
|
296
|
-
rowHeight:
|
|
298
|
+
overscanCount: f = 3,
|
|
299
|
+
rowCount: p,
|
|
300
|
+
rowHeight: I,
|
|
297
301
|
style: b,
|
|
298
|
-
...
|
|
302
|
+
...y
|
|
299
303
|
}) {
|
|
300
|
-
const
|
|
304
|
+
const w = A(r), d = M(
|
|
301
305
|
() => V(t, D),
|
|
302
306
|
[t]
|
|
303
|
-
), [
|
|
304
|
-
containerElement:
|
|
305
|
-
defaultContainerSize:
|
|
307
|
+
), [x, z] = $(null), h = G({
|
|
308
|
+
containerElement: x,
|
|
309
|
+
defaultContainerSize: n,
|
|
306
310
|
direction: "horizontal",
|
|
307
311
|
itemCount: s,
|
|
308
|
-
itemProps:
|
|
312
|
+
itemProps: w,
|
|
309
313
|
itemSize: e,
|
|
310
|
-
overscanCount:
|
|
311
|
-
}),
|
|
312
|
-
containerElement:
|
|
313
|
-
defaultContainerSize:
|
|
314
|
+
overscanCount: f
|
|
315
|
+
}), a = G({
|
|
316
|
+
containerElement: x,
|
|
317
|
+
defaultContainerSize: i,
|
|
314
318
|
direction: "vertical",
|
|
315
|
-
itemCount:
|
|
316
|
-
itemProps:
|
|
317
|
-
itemSize:
|
|
318
|
-
overscanCount:
|
|
319
|
-
}), { startIndex:
|
|
319
|
+
itemCount: p,
|
|
320
|
+
itemProps: w,
|
|
321
|
+
itemSize: I,
|
|
322
|
+
overscanCount: f
|
|
323
|
+
}), { startIndex: u, stopIndex: O } = h, { startIndex: m, stopIndex: g } = a;
|
|
320
324
|
U(
|
|
321
|
-
|
|
325
|
+
c,
|
|
322
326
|
() => ({
|
|
323
327
|
get element() {
|
|
324
|
-
return
|
|
328
|
+
return x;
|
|
325
329
|
},
|
|
326
330
|
scrollToCell({
|
|
327
|
-
behavior:
|
|
328
|
-
columnAlign:
|
|
329
|
-
columnIndex:
|
|
330
|
-
rowAlign:
|
|
331
|
-
rowIndex:
|
|
331
|
+
behavior: T = "auto",
|
|
332
|
+
columnAlign: v = "auto",
|
|
333
|
+
columnIndex: H,
|
|
334
|
+
rowAlign: k = "auto",
|
|
335
|
+
rowIndex: L
|
|
332
336
|
}) {
|
|
333
|
-
|
|
334
|
-
align:
|
|
335
|
-
behavior:
|
|
336
|
-
containerScrollOffset:
|
|
337
|
-
index:
|
|
338
|
-
}),
|
|
339
|
-
align:
|
|
340
|
-
behavior:
|
|
341
|
-
containerScrollOffset:
|
|
342
|
-
index:
|
|
337
|
+
a?.scrollToIndex({
|
|
338
|
+
align: k,
|
|
339
|
+
behavior: T,
|
|
340
|
+
containerScrollOffset: x?.scrollTop ?? 0,
|
|
341
|
+
index: L
|
|
342
|
+
}), h?.scrollToIndex({
|
|
343
|
+
align: v,
|
|
344
|
+
behavior: T,
|
|
345
|
+
containerScrollOffset: x?.scrollLeft ?? 0,
|
|
346
|
+
index: H
|
|
343
347
|
});
|
|
344
348
|
},
|
|
345
349
|
scrollToColumn({
|
|
346
|
-
align:
|
|
347
|
-
behavior:
|
|
348
|
-
index:
|
|
350
|
+
align: T = "auto",
|
|
351
|
+
behavior: v = "auto",
|
|
352
|
+
index: H
|
|
349
353
|
}) {
|
|
350
|
-
|
|
351
|
-
align:
|
|
352
|
-
behavior:
|
|
353
|
-
containerScrollOffset:
|
|
354
|
-
index:
|
|
354
|
+
h?.scrollToIndex({
|
|
355
|
+
align: T,
|
|
356
|
+
behavior: v,
|
|
357
|
+
containerScrollOffset: x?.scrollLeft ?? 0,
|
|
358
|
+
index: H
|
|
355
359
|
});
|
|
356
360
|
},
|
|
357
361
|
scrollToRow({
|
|
358
|
-
align:
|
|
359
|
-
behavior:
|
|
360
|
-
index:
|
|
362
|
+
align: T = "auto",
|
|
363
|
+
behavior: v = "auto",
|
|
364
|
+
index: H
|
|
361
365
|
}) {
|
|
362
|
-
|
|
363
|
-
align:
|
|
364
|
-
behavior:
|
|
365
|
-
containerScrollOffset:
|
|
366
|
-
index:
|
|
366
|
+
a?.scrollToIndex({
|
|
367
|
+
align: T,
|
|
368
|
+
behavior: v,
|
|
369
|
+
containerScrollOffset: x?.scrollTop ?? 0,
|
|
370
|
+
index: H
|
|
367
371
|
});
|
|
368
372
|
}
|
|
369
373
|
}),
|
|
370
|
-
[
|
|
371
|
-
),
|
|
372
|
-
|
|
373
|
-
columnStartIndex:
|
|
374
|
-
columnStopIndex:
|
|
375
|
-
rowStartIndex:
|
|
376
|
-
rowStopIndex:
|
|
374
|
+
[h, x, a]
|
|
375
|
+
), P(() => {
|
|
376
|
+
u >= 0 && O >= 0 && m >= 0 && g >= 0 && o && o({
|
|
377
|
+
columnStartIndex: u,
|
|
378
|
+
columnStopIndex: O,
|
|
379
|
+
rowStartIndex: m,
|
|
380
|
+
rowStopIndex: g
|
|
377
381
|
});
|
|
378
382
|
}, [
|
|
379
383
|
o,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
+
u,
|
|
385
|
+
O,
|
|
386
|
+
m,
|
|
387
|
+
g
|
|
384
388
|
]);
|
|
385
|
-
const
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
for (let
|
|
389
|
-
const
|
|
390
|
-
for (let
|
|
391
|
-
const
|
|
392
|
-
|
|
389
|
+
const S = M(() => {
|
|
390
|
+
const T = [];
|
|
391
|
+
if (h && s > 0 && a && p > 0)
|
|
392
|
+
for (let v = m; v <= g; v++) {
|
|
393
|
+
const H = a.getCellBounds(v);
|
|
394
|
+
for (let k = u; k <= O; k++) {
|
|
395
|
+
const L = h.getCellBounds(k);
|
|
396
|
+
T.push(
|
|
393
397
|
/* @__PURE__ */ F(
|
|
394
|
-
|
|
398
|
+
d,
|
|
395
399
|
{
|
|
396
|
-
...
|
|
397
|
-
columnIndex:
|
|
398
|
-
key: `${
|
|
399
|
-
rowIndex:
|
|
400
|
+
...w,
|
|
401
|
+
columnIndex: k,
|
|
402
|
+
key: `${v}-${k}`,
|
|
403
|
+
rowIndex: v,
|
|
400
404
|
style: {
|
|
401
405
|
position: "absolute",
|
|
402
406
|
left: 0,
|
|
403
|
-
transform: `translate(${
|
|
404
|
-
height:
|
|
405
|
-
width:
|
|
407
|
+
transform: `translate(${L.scrollOffset}px, ${H.scrollOffset}px)`,
|
|
408
|
+
height: H.size,
|
|
409
|
+
width: L.size
|
|
406
410
|
}
|
|
407
411
|
}
|
|
408
412
|
)
|
|
409
413
|
);
|
|
410
414
|
}
|
|
411
415
|
}
|
|
412
|
-
return
|
|
416
|
+
return T;
|
|
413
417
|
}, [
|
|
414
|
-
w,
|
|
415
418
|
d,
|
|
419
|
+
w,
|
|
416
420
|
s,
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
p,
|
|
420
|
-
a,
|
|
421
|
-
I,
|
|
421
|
+
u,
|
|
422
|
+
O,
|
|
422
423
|
h,
|
|
423
|
-
|
|
424
|
+
p,
|
|
425
|
+
m,
|
|
426
|
+
g,
|
|
427
|
+
a
|
|
424
428
|
]);
|
|
425
429
|
return /* @__PURE__ */ j(
|
|
426
430
|
"div",
|
|
427
431
|
{
|
|
428
432
|
role: "grid",
|
|
429
|
-
...
|
|
430
|
-
className:
|
|
433
|
+
...y,
|
|
434
|
+
className: l,
|
|
431
435
|
onScroll: () => {
|
|
432
|
-
|
|
436
|
+
h.onScroll(), a.onScroll();
|
|
433
437
|
},
|
|
434
|
-
ref:
|
|
438
|
+
ref: z,
|
|
435
439
|
style: {
|
|
436
440
|
...b,
|
|
437
441
|
maxHeight: "100%",
|
|
@@ -442,112 +446,112 @@ function et({
|
|
|
442
446
|
children: /* @__PURE__ */ j(
|
|
443
447
|
"div",
|
|
444
448
|
{
|
|
445
|
-
className:
|
|
449
|
+
className: l,
|
|
446
450
|
style: {
|
|
447
451
|
position: "relative",
|
|
448
|
-
height:
|
|
449
|
-
width:
|
|
452
|
+
height: a?.getEstimatedHeight(),
|
|
453
|
+
width: h?.getEstimatedHeight()
|
|
450
454
|
},
|
|
451
|
-
children:
|
|
455
|
+
children: S
|
|
452
456
|
}
|
|
453
457
|
)
|
|
454
458
|
}
|
|
455
459
|
);
|
|
456
460
|
}
|
|
457
|
-
const st = Y;
|
|
458
|
-
function
|
|
461
|
+
const st = $, ot = Y;
|
|
462
|
+
function rt({
|
|
459
463
|
className: t,
|
|
460
464
|
defaultHeight: r = 0,
|
|
461
|
-
listRef:
|
|
465
|
+
listRef: l,
|
|
462
466
|
onRowsRendered: s,
|
|
463
467
|
overscanCount: e = 3,
|
|
464
|
-
rowComponent:
|
|
465
|
-
rowCount:
|
|
466
|
-
rowHeight:
|
|
468
|
+
rowComponent: i,
|
|
469
|
+
rowCount: n,
|
|
470
|
+
rowHeight: c,
|
|
467
471
|
rowProps: o,
|
|
468
|
-
style:
|
|
469
|
-
...
|
|
472
|
+
style: f,
|
|
473
|
+
...p
|
|
470
474
|
}) {
|
|
471
|
-
const
|
|
472
|
-
() => V(
|
|
473
|
-
[
|
|
474
|
-
), [
|
|
475
|
-
getCellBounds:
|
|
476
|
-
getEstimatedHeight:
|
|
477
|
-
onScroll:
|
|
478
|
-
scrollToIndex:
|
|
479
|
-
startIndex:
|
|
480
|
-
stopIndex:
|
|
481
|
-
} =
|
|
482
|
-
containerElement:
|
|
475
|
+
const I = A(o), b = M(
|
|
476
|
+
() => V(i, D),
|
|
477
|
+
[i]
|
|
478
|
+
), [y, w] = $(null), {
|
|
479
|
+
getCellBounds: d,
|
|
480
|
+
getEstimatedHeight: x,
|
|
481
|
+
onScroll: z,
|
|
482
|
+
scrollToIndex: h,
|
|
483
|
+
startIndex: a,
|
|
484
|
+
stopIndex: u
|
|
485
|
+
} = G({
|
|
486
|
+
containerElement: y,
|
|
483
487
|
defaultContainerSize: r,
|
|
484
488
|
direction: "vertical",
|
|
485
|
-
itemCount:
|
|
486
|
-
itemProps:
|
|
487
|
-
itemSize:
|
|
489
|
+
itemCount: n,
|
|
490
|
+
itemProps: I,
|
|
491
|
+
itemSize: c,
|
|
488
492
|
overscanCount: e
|
|
489
493
|
});
|
|
490
494
|
U(
|
|
491
|
-
|
|
495
|
+
l,
|
|
492
496
|
() => ({
|
|
493
497
|
get element() {
|
|
494
|
-
return
|
|
498
|
+
return y;
|
|
495
499
|
},
|
|
496
500
|
scrollToRow({
|
|
497
|
-
align:
|
|
498
|
-
behavior:
|
|
499
|
-
index:
|
|
501
|
+
align: m = "auto",
|
|
502
|
+
behavior: g = "auto",
|
|
503
|
+
index: S
|
|
500
504
|
}) {
|
|
501
|
-
|
|
502
|
-
align:
|
|
503
|
-
behavior:
|
|
504
|
-
containerScrollOffset:
|
|
505
|
-
index:
|
|
505
|
+
h({
|
|
506
|
+
align: m,
|
|
507
|
+
behavior: g,
|
|
508
|
+
containerScrollOffset: y?.scrollTop ?? 0,
|
|
509
|
+
index: S
|
|
506
510
|
});
|
|
507
511
|
}
|
|
508
512
|
}),
|
|
509
|
-
[
|
|
510
|
-
),
|
|
511
|
-
|
|
512
|
-
startIndex:
|
|
513
|
-
stopIndex:
|
|
513
|
+
[y, h]
|
|
514
|
+
), P(() => {
|
|
515
|
+
a >= 0 && u >= 0 && s && s({
|
|
516
|
+
startIndex: a,
|
|
517
|
+
stopIndex: u
|
|
514
518
|
});
|
|
515
|
-
}, [s,
|
|
516
|
-
const
|
|
517
|
-
const
|
|
518
|
-
if (
|
|
519
|
-
for (let
|
|
520
|
-
const
|
|
521
|
-
|
|
519
|
+
}, [s, a, u]);
|
|
520
|
+
const O = M(() => {
|
|
521
|
+
const m = [];
|
|
522
|
+
if (n > 0)
|
|
523
|
+
for (let g = a; g <= u; g++) {
|
|
524
|
+
const S = d(g);
|
|
525
|
+
m.push(
|
|
522
526
|
/* @__PURE__ */ F(
|
|
523
527
|
b,
|
|
524
528
|
{
|
|
525
|
-
...
|
|
526
|
-
key:
|
|
527
|
-
index:
|
|
529
|
+
...I,
|
|
530
|
+
key: g,
|
|
531
|
+
index: g,
|
|
528
532
|
style: {
|
|
529
533
|
position: "absolute",
|
|
530
534
|
left: 0,
|
|
531
|
-
transform: `translateY(${
|
|
532
|
-
height:
|
|
535
|
+
transform: `translateY(${S.scrollOffset}px)`,
|
|
536
|
+
height: S.size,
|
|
533
537
|
width: "100%"
|
|
534
538
|
}
|
|
535
539
|
}
|
|
536
540
|
)
|
|
537
541
|
);
|
|
538
542
|
}
|
|
539
|
-
return
|
|
540
|
-
}, [b,
|
|
543
|
+
return m;
|
|
544
|
+
}, [b, d, n, I, a, u]);
|
|
541
545
|
return /* @__PURE__ */ j(
|
|
542
546
|
"div",
|
|
543
547
|
{
|
|
544
548
|
role: "list",
|
|
545
|
-
...
|
|
549
|
+
...p,
|
|
546
550
|
className: t,
|
|
547
|
-
onScroll:
|
|
548
|
-
ref:
|
|
551
|
+
onScroll: z,
|
|
552
|
+
ref: w,
|
|
549
553
|
style: {
|
|
550
|
-
...
|
|
554
|
+
...f,
|
|
551
555
|
maxHeight: "100%",
|
|
552
556
|
flexGrow: 1,
|
|
553
557
|
overflowY: "auto"
|
|
@@ -557,20 +561,22 @@ function ot({
|
|
|
557
561
|
{
|
|
558
562
|
className: t,
|
|
559
563
|
style: {
|
|
560
|
-
height:
|
|
564
|
+
height: x(),
|
|
561
565
|
position: "relative",
|
|
562
566
|
width: "100%"
|
|
563
567
|
},
|
|
564
|
-
children:
|
|
568
|
+
children: O
|
|
565
569
|
}
|
|
566
570
|
)
|
|
567
571
|
}
|
|
568
572
|
);
|
|
569
573
|
}
|
|
570
|
-
const
|
|
574
|
+
const lt = $, nt = Y;
|
|
571
575
|
export {
|
|
572
576
|
et as Grid,
|
|
573
|
-
|
|
574
|
-
st as
|
|
575
|
-
|
|
577
|
+
rt as List,
|
|
578
|
+
st as useGridCallbackRef,
|
|
579
|
+
ot as useGridRef,
|
|
580
|
+
lt as useListCallbackRef,
|
|
581
|
+
nt as useListRef
|
|
576
582
|
};
|