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