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