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