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