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