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