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