react-window 2.2.0-alpha.0 → 2.2.1-alpha.0
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 +0 -10
- package/dist/react-window.cjs +1 -1
- package/dist/react-window.cjs.map +1 -1
- package/dist/react-window.js +210 -207
- package/dist/react-window.js.map +1 -1
- package/package.json +1 -1
package/dist/react-window.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as P } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
function
|
|
2
|
+
import { useState as H, useLayoutEffect as se, useEffect as J, useMemo as L, useRef as K, useCallback as U, memo as le, useImperativeHandle as ce, createElement as X } from "react";
|
|
3
|
+
function ge(e) {
|
|
4
4
|
let t = e;
|
|
5
5
|
for (; t; ) {
|
|
6
6
|
if (t.dir)
|
|
@@ -10,9 +10,9 @@ function xe(e) {
|
|
|
10
10
|
return !1;
|
|
11
11
|
}
|
|
12
12
|
function ve(e, t) {
|
|
13
|
-
const [s, r] =
|
|
13
|
+
const [s, r] = H(t === "rtl");
|
|
14
14
|
return se(() => {
|
|
15
|
-
e && (t || r(
|
|
15
|
+
e && (t || r(ge(e)));
|
|
16
16
|
}, [t, e]), s;
|
|
17
17
|
}
|
|
18
18
|
const q = typeof window < "u" ? se : J;
|
|
@@ -37,42 +37,42 @@ function be({
|
|
|
37
37
|
mode: o,
|
|
38
38
|
style: i
|
|
39
39
|
}) {
|
|
40
|
-
const { styleHeight:
|
|
40
|
+
const { styleHeight: f, styleWidth: l } = L(
|
|
41
41
|
() => ({
|
|
42
42
|
styleHeight: oe(i?.height),
|
|
43
43
|
styleWidth: oe(i?.width)
|
|
44
44
|
}),
|
|
45
45
|
[i?.height, i?.width]
|
|
46
|
-
), [c, d] =
|
|
46
|
+
), [c, d] = H({
|
|
47
47
|
height: t,
|
|
48
48
|
width: s
|
|
49
|
-
}),
|
|
49
|
+
}), a = r || o === "only-height" && f !== void 0 || o === "only-width" && l !== void 0 || f !== void 0 && l !== void 0;
|
|
50
50
|
return q(() => {
|
|
51
|
-
if (n === null ||
|
|
51
|
+
if (n === null || a)
|
|
52
52
|
return;
|
|
53
|
-
const
|
|
54
|
-
for (const
|
|
55
|
-
const { contentRect: I, target:
|
|
56
|
-
n ===
|
|
53
|
+
const u = new ResizeObserver((b) => {
|
|
54
|
+
for (const w of b) {
|
|
55
|
+
const { contentRect: I, target: x } = w;
|
|
56
|
+
n === x && d((m) => m.height === I.height && m.width === I.width ? m : {
|
|
57
57
|
height: I.height,
|
|
58
58
|
width: I.width
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
return
|
|
63
|
-
|
|
62
|
+
return u.observe(n, { box: e }), () => {
|
|
63
|
+
u?.unobserve(n);
|
|
64
64
|
};
|
|
65
|
-
}, [e,
|
|
65
|
+
}, [e, a, n, f, l]), L(
|
|
66
66
|
() => ({
|
|
67
|
-
height:
|
|
67
|
+
height: f ?? c.height,
|
|
68
68
|
width: l ?? c.width
|
|
69
69
|
}),
|
|
70
|
-
[c,
|
|
70
|
+
[c, f, l]
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
function ae(e) {
|
|
74
74
|
const t = K(() => {
|
|
75
|
-
throw new Error("Cannot call
|
|
75
|
+
throw new Error("Cannot call during render.");
|
|
76
76
|
});
|
|
77
77
|
return q(() => {
|
|
78
78
|
t.current = e;
|
|
@@ -108,14 +108,14 @@ function Z({
|
|
|
108
108
|
}
|
|
109
109
|
return r;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function $(e, t = "Assertion error") {
|
|
112
112
|
if (!e)
|
|
113
113
|
throw console.error(t), Error(t);
|
|
114
114
|
}
|
|
115
115
|
function Y(e, t) {
|
|
116
116
|
if (e === t)
|
|
117
117
|
return !0;
|
|
118
|
-
if (!!e != !!t || (
|
|
118
|
+
if (!!e != !!t || ($(e !== void 0), $(t !== void 0), Object.keys(e).length !== Object.keys(t).length))
|
|
119
119
|
return !1;
|
|
120
120
|
for (const s in e)
|
|
121
121
|
if (!Object.is(t[s], e[s]))
|
|
@@ -135,12 +135,12 @@ function fe({
|
|
|
135
135
|
const r = e.get(
|
|
136
136
|
e.size === 0 ? 0 : e.size - 1
|
|
137
137
|
);
|
|
138
|
-
|
|
138
|
+
$(r !== void 0, "Unexpected bounds cache miss");
|
|
139
139
|
const n = (r.scrollOffset + r.size) / e.size;
|
|
140
140
|
return t * n;
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function me({
|
|
144
144
|
align: e,
|
|
145
145
|
cachedBounds: t,
|
|
146
146
|
index: s,
|
|
@@ -149,13 +149,13 @@ function we({
|
|
|
149
149
|
containerScrollOffset: o,
|
|
150
150
|
containerSize: i
|
|
151
151
|
}) {
|
|
152
|
-
const
|
|
152
|
+
const f = fe({
|
|
153
153
|
cachedBounds: t,
|
|
154
154
|
itemCount: r,
|
|
155
155
|
itemSize: n
|
|
156
156
|
}), l = t.get(s), c = Math.max(
|
|
157
157
|
0,
|
|
158
|
-
Math.min(
|
|
158
|
+
Math.min(f - i, l.scrollOffset)
|
|
159
159
|
), d = Math.max(
|
|
160
160
|
0,
|
|
161
161
|
l.scrollOffset - i + l.size
|
|
@@ -166,7 +166,7 @@ function we({
|
|
|
166
166
|
case "end":
|
|
167
167
|
return d;
|
|
168
168
|
case "center":
|
|
169
|
-
return l.scrollOffset <= i / 2 ? 0 : l.scrollOffset + l.size / 2 >=
|
|
169
|
+
return l.scrollOffset <= i / 2 ? 0 : l.scrollOffset + l.size / 2 >= f - i / 2 ? f - i : l.scrollOffset + l.size / 2 - i / 2;
|
|
170
170
|
case "auto":
|
|
171
171
|
default:
|
|
172
172
|
return o >= d && o <= c ? o : o < d ? d : c;
|
|
@@ -180,27 +180,27 @@ function ie({
|
|
|
180
180
|
overscanCount: n
|
|
181
181
|
}) {
|
|
182
182
|
const o = r - 1;
|
|
183
|
-
let i = 0,
|
|
183
|
+
let i = 0, f = -1, l = 0, c = -1, d = 0;
|
|
184
184
|
for (; d < o; ) {
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
185
|
+
const a = e.get(d);
|
|
186
|
+
if (a.scrollOffset + a.size > t)
|
|
187
187
|
break;
|
|
188
188
|
d++;
|
|
189
189
|
}
|
|
190
190
|
for (i = d, l = Math.max(0, i - n); d < o; ) {
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
191
|
+
const a = e.get(d);
|
|
192
|
+
if (a.scrollOffset + a.size >= t + s)
|
|
193
193
|
break;
|
|
194
194
|
d++;
|
|
195
195
|
}
|
|
196
|
-
return
|
|
196
|
+
return f = Math.min(o, d), c = Math.min(r - 1, f + n), i < 0 && (i = 0, f = -1, l = 0, c = -1), {
|
|
197
197
|
startIndexVisible: i,
|
|
198
|
-
stopIndexVisible:
|
|
198
|
+
stopIndexVisible: f,
|
|
199
199
|
startIndexOverscan: l,
|
|
200
200
|
stopIndexOverscan: c
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function we({
|
|
204
204
|
itemCount: e,
|
|
205
205
|
itemProps: t,
|
|
206
206
|
itemSize: s
|
|
@@ -208,37 +208,37 @@ function me({
|
|
|
208
208
|
const r = /* @__PURE__ */ new Map();
|
|
209
209
|
return {
|
|
210
210
|
get(n) {
|
|
211
|
-
for (
|
|
211
|
+
for ($(n < e, `Invalid index ${n}`); r.size - 1 < n; ) {
|
|
212
212
|
const i = r.size;
|
|
213
|
-
let
|
|
213
|
+
let f;
|
|
214
214
|
switch (typeof s) {
|
|
215
215
|
case "function": {
|
|
216
|
-
|
|
216
|
+
f = s(i, t);
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
case "number": {
|
|
220
|
-
|
|
220
|
+
f = s;
|
|
221
221
|
break;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
if (i === 0)
|
|
225
225
|
r.set(i, {
|
|
226
|
-
size:
|
|
226
|
+
size: f,
|
|
227
227
|
scrollOffset: 0
|
|
228
228
|
});
|
|
229
229
|
else {
|
|
230
230
|
const l = r.get(i - 1);
|
|
231
|
-
|
|
231
|
+
$(
|
|
232
232
|
l !== void 0,
|
|
233
233
|
`Unexpected bounds cache miss for index ${n}`
|
|
234
234
|
), r.set(i, {
|
|
235
235
|
scrollOffset: l.scrollOffset + l.size,
|
|
236
|
-
size:
|
|
236
|
+
size: f
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
const o = r.get(n);
|
|
241
|
-
return
|
|
241
|
+
return $(
|
|
242
242
|
o !== void 0,
|
|
243
243
|
`Unexpected bounds cache miss for index ${n}`
|
|
244
244
|
), o;
|
|
@@ -257,7 +257,7 @@ function Oe({
|
|
|
257
257
|
itemSize: s
|
|
258
258
|
}) {
|
|
259
259
|
return L(
|
|
260
|
-
() =>
|
|
260
|
+
() => we({
|
|
261
261
|
itemCount: e,
|
|
262
262
|
itemProps: t,
|
|
263
263
|
itemSize: s
|
|
@@ -272,10 +272,10 @@ function ye({
|
|
|
272
272
|
let s;
|
|
273
273
|
switch (typeof t) {
|
|
274
274
|
case "string": {
|
|
275
|
-
|
|
275
|
+
$(
|
|
276
276
|
t.endsWith("%"),
|
|
277
277
|
`Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`
|
|
278
|
-
),
|
|
278
|
+
), $(
|
|
279
279
|
e !== void 0,
|
|
280
280
|
"Container size must be defined if a percentage item size is specified"
|
|
281
281
|
), s = e * parseInt(t) / 100;
|
|
@@ -296,26 +296,26 @@ function ee({
|
|
|
296
296
|
isRtl: n = !1,
|
|
297
297
|
itemCount: o,
|
|
298
298
|
itemProps: i,
|
|
299
|
-
itemSize:
|
|
299
|
+
itemSize: f,
|
|
300
300
|
onResize: l,
|
|
301
301
|
overscanCount: c
|
|
302
302
|
}) {
|
|
303
|
-
const [d,
|
|
303
|
+
const [d, a] = H({
|
|
304
304
|
startIndexVisible: 0,
|
|
305
305
|
startIndexOverscan: 0,
|
|
306
306
|
stopIndexVisible: -1,
|
|
307
307
|
stopIndexOverscan: -1
|
|
308
308
|
}), {
|
|
309
|
-
startIndexVisible:
|
|
309
|
+
startIndexVisible: u,
|
|
310
310
|
startIndexOverscan: b,
|
|
311
|
-
stopIndexVisible:
|
|
311
|
+
stopIndexVisible: w,
|
|
312
312
|
stopIndexOverscan: I
|
|
313
313
|
} = {
|
|
314
314
|
startIndexVisible: Math.min(o - 1, d.startIndexVisible),
|
|
315
315
|
startIndexOverscan: Math.min(o - 1, d.startIndexOverscan),
|
|
316
316
|
stopIndexVisible: Math.min(o - 1, d.stopIndexVisible),
|
|
317
317
|
stopIndexOverscan: Math.min(o - 1, d.stopIndexOverscan)
|
|
318
|
-
}, { height:
|
|
318
|
+
}, { height: x = s, width: m = s } = be({
|
|
319
319
|
defaultHeight: r === "vertical" ? s : void 0,
|
|
320
320
|
defaultWidth: r === "horizontal" ? s : void 0,
|
|
321
321
|
element: e,
|
|
@@ -324,39 +324,39 @@ function ee({
|
|
|
324
324
|
}), y = K({
|
|
325
325
|
height: 0,
|
|
326
326
|
width: 0
|
|
327
|
-
}),
|
|
327
|
+
}), E = r === "vertical" ? x : m, h = ye({ containerSize: E, itemSize: f });
|
|
328
328
|
se(() => {
|
|
329
329
|
if (typeof l == "function") {
|
|
330
|
-
const
|
|
331
|
-
(
|
|
330
|
+
const p = y.current;
|
|
331
|
+
(p.height !== x || p.width !== m) && (l({ height: x, width: m }, { ...p }), p.height = x, p.width = m);
|
|
332
332
|
}
|
|
333
|
-
}, [
|
|
333
|
+
}, [x, l, m]);
|
|
334
334
|
const z = Oe({
|
|
335
335
|
itemCount: o,
|
|
336
336
|
itemProps: i,
|
|
337
|
-
itemSize:
|
|
337
|
+
itemSize: h
|
|
338
338
|
}), k = U(
|
|
339
|
-
(
|
|
339
|
+
(p) => z.get(p),
|
|
340
340
|
[z]
|
|
341
341
|
), S = U(
|
|
342
342
|
() => fe({
|
|
343
343
|
cachedBounds: z,
|
|
344
344
|
itemCount: o,
|
|
345
|
-
itemSize:
|
|
345
|
+
itemSize: h
|
|
346
346
|
}),
|
|
347
|
-
[z, o,
|
|
347
|
+
[z, o, h]
|
|
348
348
|
), W = U(
|
|
349
|
-
(
|
|
349
|
+
(p) => {
|
|
350
350
|
const T = Z({
|
|
351
351
|
containerElement: e,
|
|
352
352
|
direction: r,
|
|
353
353
|
isRtl: n,
|
|
354
|
-
scrollOffset:
|
|
354
|
+
scrollOffset: p
|
|
355
355
|
});
|
|
356
356
|
return ie({
|
|
357
357
|
cachedBounds: z,
|
|
358
358
|
containerScrollOffset: T,
|
|
359
|
-
containerSize:
|
|
359
|
+
containerSize: E,
|
|
360
360
|
itemCount: o,
|
|
361
361
|
overscanCount: c
|
|
362
362
|
});
|
|
@@ -364,7 +364,7 @@ function ee({
|
|
|
364
364
|
[
|
|
365
365
|
z,
|
|
366
366
|
e,
|
|
367
|
-
|
|
367
|
+
E,
|
|
368
368
|
r,
|
|
369
369
|
n,
|
|
370
370
|
o,
|
|
@@ -372,53 +372,53 @@ function ee({
|
|
|
372
372
|
]
|
|
373
373
|
);
|
|
374
374
|
q(() => {
|
|
375
|
-
const
|
|
376
|
-
|
|
375
|
+
const p = (r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0;
|
|
376
|
+
a(W(p));
|
|
377
377
|
}, [e, r, W]), q(() => {
|
|
378
378
|
if (!e)
|
|
379
379
|
return;
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
-
const { scrollLeft:
|
|
380
|
+
const p = () => {
|
|
381
|
+
a((T) => {
|
|
382
|
+
const { scrollLeft: R, scrollTop: v } = e, g = Z({
|
|
383
383
|
containerElement: e,
|
|
384
384
|
direction: r,
|
|
385
385
|
isRtl: n,
|
|
386
|
-
scrollOffset: r === "vertical" ? v :
|
|
386
|
+
scrollOffset: r === "vertical" ? v : R
|
|
387
387
|
}), A = ie({
|
|
388
388
|
cachedBounds: z,
|
|
389
|
-
containerScrollOffset:
|
|
390
|
-
containerSize:
|
|
389
|
+
containerScrollOffset: g,
|
|
390
|
+
containerSize: E,
|
|
391
391
|
itemCount: o,
|
|
392
392
|
overscanCount: c
|
|
393
393
|
});
|
|
394
394
|
return Y(A, T) ? T : A;
|
|
395
395
|
});
|
|
396
396
|
};
|
|
397
|
-
return e.addEventListener("scroll",
|
|
398
|
-
e.removeEventListener("scroll",
|
|
397
|
+
return e.addEventListener("scroll", p), () => {
|
|
398
|
+
e.removeEventListener("scroll", p);
|
|
399
399
|
};
|
|
400
400
|
}, [
|
|
401
401
|
z,
|
|
402
402
|
e,
|
|
403
|
-
|
|
403
|
+
E,
|
|
404
404
|
r,
|
|
405
405
|
o,
|
|
406
406
|
c
|
|
407
407
|
]);
|
|
408
408
|
const O = ae(
|
|
409
409
|
({
|
|
410
|
-
align:
|
|
410
|
+
align: p = "auto",
|
|
411
411
|
containerScrollOffset: T,
|
|
412
|
-
index:
|
|
412
|
+
index: R
|
|
413
413
|
}) => {
|
|
414
|
-
let v =
|
|
415
|
-
align:
|
|
414
|
+
let v = me({
|
|
415
|
+
align: p,
|
|
416
416
|
cachedBounds: z,
|
|
417
417
|
containerScrollOffset: T,
|
|
418
|
-
containerSize:
|
|
419
|
-
index:
|
|
418
|
+
containerSize: E,
|
|
419
|
+
index: R,
|
|
420
420
|
itemCount: o,
|
|
421
|
-
itemSize:
|
|
421
|
+
itemSize: h
|
|
422
422
|
});
|
|
423
423
|
if (e) {
|
|
424
424
|
if (v = Z({
|
|
@@ -427,8 +427,8 @@ function ee({
|
|
|
427
427
|
isRtl: n,
|
|
428
428
|
scrollOffset: v
|
|
429
429
|
}), typeof e.scrollTo != "function") {
|
|
430
|
-
const
|
|
431
|
-
Y(d,
|
|
430
|
+
const g = W(v);
|
|
431
|
+
Y(d, g) || a(g);
|
|
432
432
|
}
|
|
433
433
|
return v;
|
|
434
434
|
}
|
|
@@ -439,9 +439,9 @@ function ee({
|
|
|
439
439
|
getEstimatedSize: S,
|
|
440
440
|
scrollToIndex: O,
|
|
441
441
|
startIndexOverscan: b,
|
|
442
|
-
startIndexVisible:
|
|
442
|
+
startIndexVisible: u,
|
|
443
443
|
stopIndexOverscan: I,
|
|
444
|
-
stopIndexVisible:
|
|
444
|
+
stopIndexVisible: w
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
447
|
function de(e) {
|
|
@@ -455,11 +455,11 @@ function ue(e, t) {
|
|
|
455
455
|
} = e, {
|
|
456
456
|
ariaAttributes: o,
|
|
457
457
|
style: i,
|
|
458
|
-
...
|
|
458
|
+
...f
|
|
459
459
|
} = t;
|
|
460
|
-
return Y(s, o) && Y(r, i) && Y(n,
|
|
460
|
+
return Y(s, o) && Y(r, i) && Y(n, f);
|
|
461
461
|
}
|
|
462
|
-
function
|
|
462
|
+
function Ve({
|
|
463
463
|
cellComponent: e,
|
|
464
464
|
cellProps: t,
|
|
465
465
|
children: s,
|
|
@@ -467,42 +467,42 @@ function Re({
|
|
|
467
467
|
columnCount: n,
|
|
468
468
|
columnWidth: o,
|
|
469
469
|
defaultHeight: i = 0,
|
|
470
|
-
defaultWidth:
|
|
470
|
+
defaultWidth: f = 0,
|
|
471
471
|
dir: l,
|
|
472
472
|
gridRef: c,
|
|
473
473
|
onCellsRendered: d,
|
|
474
|
-
onResize:
|
|
475
|
-
overscanCount:
|
|
474
|
+
onResize: a,
|
|
475
|
+
overscanCount: u = 3,
|
|
476
476
|
rowCount: b,
|
|
477
|
-
rowHeight:
|
|
477
|
+
rowHeight: w,
|
|
478
478
|
style: I,
|
|
479
|
-
tagName:
|
|
480
|
-
...
|
|
479
|
+
tagName: x = "div",
|
|
480
|
+
...m
|
|
481
481
|
}) {
|
|
482
|
-
const y = de(t),
|
|
482
|
+
const y = de(t), E = L(
|
|
483
483
|
() => le(e, ue),
|
|
484
484
|
[e]
|
|
485
|
-
), [
|
|
485
|
+
), [h, z] = H(null), k = ve(h, l), {
|
|
486
486
|
getCellBounds: S,
|
|
487
487
|
getEstimatedSize: W,
|
|
488
488
|
startIndexOverscan: O,
|
|
489
|
-
startIndexVisible:
|
|
489
|
+
startIndexVisible: p,
|
|
490
490
|
scrollToIndex: T,
|
|
491
|
-
stopIndexOverscan:
|
|
491
|
+
stopIndexOverscan: R,
|
|
492
492
|
stopIndexVisible: v
|
|
493
493
|
} = ee({
|
|
494
|
-
containerElement:
|
|
494
|
+
containerElement: h,
|
|
495
495
|
containerStyle: I,
|
|
496
|
-
defaultContainerSize:
|
|
496
|
+
defaultContainerSize: f,
|
|
497
497
|
direction: "horizontal",
|
|
498
498
|
isRtl: k,
|
|
499
499
|
itemCount: n,
|
|
500
500
|
itemProps: y,
|
|
501
501
|
itemSize: o,
|
|
502
|
-
onResize:
|
|
503
|
-
overscanCount:
|
|
502
|
+
onResize: a,
|
|
503
|
+
overscanCount: u
|
|
504
504
|
}), {
|
|
505
|
-
getCellBounds:
|
|
505
|
+
getCellBounds: g,
|
|
506
506
|
getEstimatedSize: A,
|
|
507
507
|
startIndexOverscan: M,
|
|
508
508
|
startIndexVisible: re,
|
|
@@ -510,87 +510,87 @@ function Re({
|
|
|
510
510
|
stopIndexOverscan: _,
|
|
511
511
|
stopIndexVisible: ne
|
|
512
512
|
} = ee({
|
|
513
|
-
containerElement:
|
|
513
|
+
containerElement: h,
|
|
514
514
|
containerStyle: I,
|
|
515
515
|
defaultContainerSize: i,
|
|
516
516
|
direction: "vertical",
|
|
517
517
|
itemCount: b,
|
|
518
518
|
itemProps: y,
|
|
519
|
-
itemSize:
|
|
520
|
-
onResize:
|
|
521
|
-
overscanCount:
|
|
519
|
+
itemSize: w,
|
|
520
|
+
onResize: a,
|
|
521
|
+
overscanCount: u
|
|
522
522
|
});
|
|
523
523
|
ce(
|
|
524
524
|
c,
|
|
525
525
|
() => ({
|
|
526
526
|
get element() {
|
|
527
|
-
return
|
|
527
|
+
return h;
|
|
528
528
|
},
|
|
529
529
|
scrollToCell({
|
|
530
530
|
behavior: B = "auto",
|
|
531
|
-
columnAlign:
|
|
531
|
+
columnAlign: V = "auto",
|
|
532
532
|
columnIndex: j,
|
|
533
533
|
rowAlign: D = "auto",
|
|
534
534
|
rowIndex: G
|
|
535
535
|
}) {
|
|
536
536
|
const N = T({
|
|
537
|
-
align:
|
|
538
|
-
containerScrollOffset:
|
|
537
|
+
align: V,
|
|
538
|
+
containerScrollOffset: h?.scrollLeft ?? 0,
|
|
539
539
|
index: j
|
|
540
|
-
}),
|
|
540
|
+
}), xe = Q({
|
|
541
541
|
align: D,
|
|
542
|
-
containerScrollOffset:
|
|
542
|
+
containerScrollOffset: h?.scrollTop ?? 0,
|
|
543
543
|
index: G
|
|
544
544
|
});
|
|
545
|
-
typeof
|
|
545
|
+
typeof h?.scrollTo == "function" && h.scrollTo({
|
|
546
546
|
behavior: B,
|
|
547
547
|
left: N,
|
|
548
|
-
top:
|
|
548
|
+
top: xe
|
|
549
549
|
});
|
|
550
550
|
},
|
|
551
551
|
scrollToColumn({
|
|
552
552
|
align: B = "auto",
|
|
553
|
-
behavior:
|
|
553
|
+
behavior: V = "auto",
|
|
554
554
|
index: j
|
|
555
555
|
}) {
|
|
556
556
|
const D = T({
|
|
557
557
|
align: B,
|
|
558
|
-
containerScrollOffset:
|
|
558
|
+
containerScrollOffset: h?.scrollLeft ?? 0,
|
|
559
559
|
index: j
|
|
560
560
|
});
|
|
561
|
-
typeof
|
|
562
|
-
behavior:
|
|
561
|
+
typeof h?.scrollTo == "function" && h.scrollTo({
|
|
562
|
+
behavior: V,
|
|
563
563
|
left: D
|
|
564
564
|
});
|
|
565
565
|
},
|
|
566
566
|
scrollToRow({
|
|
567
567
|
align: B = "auto",
|
|
568
|
-
behavior:
|
|
568
|
+
behavior: V = "auto",
|
|
569
569
|
index: j
|
|
570
570
|
}) {
|
|
571
571
|
const D = Q({
|
|
572
572
|
align: B,
|
|
573
|
-
containerScrollOffset:
|
|
573
|
+
containerScrollOffset: h?.scrollTop ?? 0,
|
|
574
574
|
index: j
|
|
575
575
|
});
|
|
576
|
-
typeof
|
|
577
|
-
behavior:
|
|
576
|
+
typeof h?.scrollTo == "function" && h.scrollTo({
|
|
577
|
+
behavior: V,
|
|
578
578
|
top: D
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
581
|
}),
|
|
582
|
-
[
|
|
582
|
+
[h, T, Q]
|
|
583
583
|
), J(() => {
|
|
584
|
-
O >= 0 &&
|
|
584
|
+
O >= 0 && R >= 0 && M >= 0 && _ >= 0 && d && d(
|
|
585
585
|
{
|
|
586
|
-
columnStartIndex:
|
|
586
|
+
columnStartIndex: p,
|
|
587
587
|
columnStopIndex: v,
|
|
588
588
|
rowStartIndex: re,
|
|
589
589
|
rowStopIndex: ne
|
|
590
590
|
},
|
|
591
591
|
{
|
|
592
592
|
columnStartIndex: O,
|
|
593
|
-
columnStopIndex:
|
|
593
|
+
columnStopIndex: R,
|
|
594
594
|
rowStartIndex: M,
|
|
595
595
|
rowStopIndex: _
|
|
596
596
|
}
|
|
@@ -598,8 +598,8 @@ function Re({
|
|
|
598
598
|
}, [
|
|
599
599
|
d,
|
|
600
600
|
O,
|
|
601
|
-
|
|
602
|
-
|
|
601
|
+
p,
|
|
602
|
+
R,
|
|
603
603
|
v,
|
|
604
604
|
M,
|
|
605
605
|
re,
|
|
@@ -609,13 +609,13 @@ function Re({
|
|
|
609
609
|
const he = L(() => {
|
|
610
610
|
const B = [];
|
|
611
611
|
if (n > 0 && b > 0)
|
|
612
|
-
for (let
|
|
613
|
-
const j =
|
|
614
|
-
for (let G = O; G <=
|
|
612
|
+
for (let V = M; V <= _; V++) {
|
|
613
|
+
const j = g(V), D = [];
|
|
614
|
+
for (let G = O; G <= R; G++) {
|
|
615
615
|
const N = S(G);
|
|
616
616
|
D.push(
|
|
617
617
|
/* @__PURE__ */ X(
|
|
618
|
-
|
|
618
|
+
E,
|
|
619
619
|
{
|
|
620
620
|
...y,
|
|
621
621
|
ariaAttributes: {
|
|
@@ -624,7 +624,7 @@ function Re({
|
|
|
624
624
|
},
|
|
625
625
|
columnIndex: G,
|
|
626
626
|
key: G,
|
|
627
|
-
rowIndex:
|
|
627
|
+
rowIndex: V,
|
|
628
628
|
style: {
|
|
629
629
|
position: "absolute",
|
|
630
630
|
left: k ? void 0 : 0,
|
|
@@ -638,18 +638,18 @@ function Re({
|
|
|
638
638
|
);
|
|
639
639
|
}
|
|
640
640
|
B.push(
|
|
641
|
-
/* @__PURE__ */ P("div", { role: "row", "aria-rowindex":
|
|
641
|
+
/* @__PURE__ */ P("div", { role: "row", "aria-rowindex": V + 1, children: D }, V)
|
|
642
642
|
);
|
|
643
643
|
}
|
|
644
644
|
return B;
|
|
645
645
|
}, [
|
|
646
|
-
|
|
646
|
+
E,
|
|
647
647
|
y,
|
|
648
648
|
n,
|
|
649
649
|
O,
|
|
650
|
-
|
|
650
|
+
R,
|
|
651
651
|
S,
|
|
652
|
-
|
|
652
|
+
g,
|
|
653
653
|
k,
|
|
654
654
|
b,
|
|
655
655
|
M,
|
|
@@ -666,12 +666,12 @@ function Re({
|
|
|
666
666
|
}
|
|
667
667
|
);
|
|
668
668
|
return X(
|
|
669
|
-
|
|
669
|
+
x,
|
|
670
670
|
{
|
|
671
671
|
"aria-colcount": n,
|
|
672
672
|
"aria-rowcount": b,
|
|
673
673
|
role: "grid",
|
|
674
|
-
...
|
|
674
|
+
...m,
|
|
675
675
|
className: r,
|
|
676
676
|
dir: l,
|
|
677
677
|
ref: z,
|
|
@@ -691,7 +691,7 @@ function Re({
|
|
|
691
691
|
pe
|
|
692
692
|
);
|
|
693
693
|
}
|
|
694
|
-
const
|
|
694
|
+
const Ee = H, Re = K;
|
|
695
695
|
function ze(e) {
|
|
696
696
|
return e != null && typeof e == "object" && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
697
697
|
}
|
|
@@ -704,33 +704,33 @@ function Ae({
|
|
|
704
704
|
onResize: n,
|
|
705
705
|
onRowsRendered: o,
|
|
706
706
|
overscanCount: i = 3,
|
|
707
|
-
rowComponent:
|
|
707
|
+
rowComponent: f,
|
|
708
708
|
rowCount: l,
|
|
709
709
|
rowHeight: c,
|
|
710
710
|
rowProps: d,
|
|
711
|
-
tagName:
|
|
712
|
-
style:
|
|
711
|
+
tagName: a = "div",
|
|
712
|
+
style: u,
|
|
713
713
|
...b
|
|
714
714
|
}) {
|
|
715
|
-
const
|
|
716
|
-
() => le(
|
|
717
|
-
[
|
|
718
|
-
), [
|
|
719
|
-
getCellBounds:
|
|
715
|
+
const w = de(d), I = L(
|
|
716
|
+
() => le(f, ue),
|
|
717
|
+
[f]
|
|
718
|
+
), [x, m] = H(null), y = ze(c), E = L(() => y ? (v) => c.getRowHeight(v) ?? c.getAverageRowHeight() : c, [y, c]), {
|
|
719
|
+
getCellBounds: h,
|
|
720
720
|
getEstimatedSize: z,
|
|
721
721
|
scrollToIndex: k,
|
|
722
722
|
startIndexOverscan: S,
|
|
723
723
|
startIndexVisible: W,
|
|
724
724
|
stopIndexOverscan: O,
|
|
725
|
-
stopIndexVisible:
|
|
725
|
+
stopIndexVisible: p
|
|
726
726
|
} = ee({
|
|
727
|
-
containerElement:
|
|
728
|
-
containerStyle:
|
|
727
|
+
containerElement: x,
|
|
728
|
+
containerStyle: u,
|
|
729
729
|
defaultContainerSize: s,
|
|
730
730
|
direction: "vertical",
|
|
731
731
|
itemCount: l,
|
|
732
|
-
itemProps:
|
|
733
|
-
itemSize:
|
|
732
|
+
itemProps: w,
|
|
733
|
+
itemSize: E,
|
|
734
734
|
onResize: n,
|
|
735
735
|
overscanCount: i
|
|
736
736
|
});
|
|
@@ -738,38 +738,38 @@ function Ae({
|
|
|
738
738
|
r,
|
|
739
739
|
() => ({
|
|
740
740
|
get element() {
|
|
741
|
-
return
|
|
741
|
+
return x;
|
|
742
742
|
},
|
|
743
743
|
scrollToRow({
|
|
744
744
|
align: v = "auto",
|
|
745
|
-
behavior:
|
|
745
|
+
behavior: g = "auto",
|
|
746
746
|
index: A
|
|
747
747
|
}) {
|
|
748
748
|
const M = k({
|
|
749
749
|
align: v,
|
|
750
|
-
containerScrollOffset:
|
|
750
|
+
containerScrollOffset: x?.scrollTop ?? 0,
|
|
751
751
|
index: A
|
|
752
752
|
});
|
|
753
|
-
typeof
|
|
754
|
-
behavior:
|
|
753
|
+
typeof x?.scrollTo == "function" && x.scrollTo({
|
|
754
|
+
behavior: g,
|
|
755
755
|
top: M
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
758
|
}),
|
|
759
|
-
[
|
|
759
|
+
[x, k]
|
|
760
760
|
), q(() => {
|
|
761
|
-
if (!
|
|
761
|
+
if (!x)
|
|
762
762
|
return;
|
|
763
|
-
const v = Array.from(
|
|
764
|
-
if (
|
|
763
|
+
const v = Array.from(x.children).filter((g, A) => {
|
|
764
|
+
if (g.hasAttribute("aria-hidden"))
|
|
765
765
|
return !1;
|
|
766
766
|
const M = `${S + A}`;
|
|
767
|
-
return
|
|
767
|
+
return g.setAttribute(te, M), !0;
|
|
768
768
|
});
|
|
769
769
|
if (y)
|
|
770
770
|
return c.observeRowElements(v);
|
|
771
771
|
}, [
|
|
772
|
-
|
|
772
|
+
x,
|
|
773
773
|
y,
|
|
774
774
|
c,
|
|
775
775
|
S,
|
|
@@ -778,7 +778,7 @@ function Ae({
|
|
|
778
778
|
S >= 0 && O >= 0 && o && o(
|
|
779
779
|
{
|
|
780
780
|
startIndex: W,
|
|
781
|
-
stopIndex:
|
|
781
|
+
stopIndex: p
|
|
782
782
|
},
|
|
783
783
|
{
|
|
784
784
|
startIndex: S,
|
|
@@ -790,25 +790,25 @@ function Ae({
|
|
|
790
790
|
S,
|
|
791
791
|
W,
|
|
792
792
|
O,
|
|
793
|
-
|
|
793
|
+
p
|
|
794
794
|
]);
|
|
795
795
|
const T = L(() => {
|
|
796
796
|
const v = [];
|
|
797
797
|
if (l > 0)
|
|
798
|
-
for (let
|
|
799
|
-
const A =
|
|
798
|
+
for (let g = S; g <= O; g++) {
|
|
799
|
+
const A = h(g);
|
|
800
800
|
v.push(
|
|
801
801
|
/* @__PURE__ */ X(
|
|
802
802
|
I,
|
|
803
803
|
{
|
|
804
|
-
...
|
|
804
|
+
...w,
|
|
805
805
|
ariaAttributes: {
|
|
806
|
-
"aria-posinset":
|
|
806
|
+
"aria-posinset": g + 1,
|
|
807
807
|
"aria-setsize": l,
|
|
808
808
|
role: "listitem"
|
|
809
809
|
},
|
|
810
|
-
key:
|
|
811
|
-
index:
|
|
810
|
+
key: g,
|
|
811
|
+
index: g,
|
|
812
812
|
style: {
|
|
813
813
|
position: "absolute",
|
|
814
814
|
left: 0,
|
|
@@ -825,13 +825,13 @@ function Ae({
|
|
|
825
825
|
return v;
|
|
826
826
|
}, [
|
|
827
827
|
I,
|
|
828
|
-
|
|
828
|
+
h,
|
|
829
829
|
y,
|
|
830
830
|
l,
|
|
831
|
-
|
|
831
|
+
w,
|
|
832
832
|
S,
|
|
833
833
|
O
|
|
834
|
-
]),
|
|
834
|
+
]), R = /* @__PURE__ */ P(
|
|
835
835
|
"div",
|
|
836
836
|
{
|
|
837
837
|
"aria-hidden": !0,
|
|
@@ -843,30 +843,30 @@ function Ae({
|
|
|
843
843
|
}
|
|
844
844
|
);
|
|
845
845
|
return X(
|
|
846
|
-
|
|
846
|
+
a,
|
|
847
847
|
{
|
|
848
848
|
role: "list",
|
|
849
849
|
...b,
|
|
850
850
|
className: t,
|
|
851
|
-
ref:
|
|
851
|
+
ref: m,
|
|
852
852
|
style: {
|
|
853
853
|
position: "relative",
|
|
854
854
|
maxHeight: "100%",
|
|
855
855
|
flexGrow: 1,
|
|
856
856
|
overflowY: "auto",
|
|
857
|
-
...
|
|
857
|
+
...u
|
|
858
858
|
}
|
|
859
859
|
},
|
|
860
860
|
T,
|
|
861
861
|
e,
|
|
862
|
-
|
|
862
|
+
R
|
|
863
863
|
);
|
|
864
864
|
}
|
|
865
865
|
function ke({
|
|
866
866
|
defaultRowHeight: e,
|
|
867
867
|
key: t
|
|
868
868
|
}) {
|
|
869
|
-
const [s, r] =
|
|
869
|
+
const [s, r] = H({
|
|
870
870
|
key: t,
|
|
871
871
|
map: /* @__PURE__ */ new Map()
|
|
872
872
|
});
|
|
@@ -875,44 +875,47 @@ function ke({
|
|
|
875
875
|
map: /* @__PURE__ */ new Map()
|
|
876
876
|
});
|
|
877
877
|
const { map: n } = s, o = U(() => {
|
|
878
|
-
let
|
|
879
|
-
return n.forEach((
|
|
880
|
-
|
|
881
|
-
}),
|
|
878
|
+
let a = 0;
|
|
879
|
+
return n.forEach((u) => {
|
|
880
|
+
a += u;
|
|
881
|
+
}), a === 0 ? e : Math.round(a / n.size);
|
|
882
882
|
}, [e, n]), i = U(
|
|
883
|
-
(
|
|
884
|
-
|
|
885
|
-
|
|
883
|
+
(a) => {
|
|
884
|
+
const u = n.get(a);
|
|
885
|
+
return u !== void 0 ? u : (n.set(a, e), e);
|
|
886
|
+
},
|
|
887
|
+
[e, n]
|
|
888
|
+
), f = U((a, u) => {
|
|
886
889
|
r((b) => {
|
|
887
|
-
if (b.map.get(
|
|
890
|
+
if (b.map.get(a) === u)
|
|
888
891
|
return b;
|
|
889
|
-
const
|
|
890
|
-
return
|
|
892
|
+
const w = new Map(b.map);
|
|
893
|
+
return w.set(a, u), {
|
|
891
894
|
...b,
|
|
892
|
-
map:
|
|
895
|
+
map: w
|
|
893
896
|
};
|
|
894
897
|
});
|
|
895
898
|
}, []), l = ae(
|
|
896
|
-
(
|
|
897
|
-
|
|
898
|
-
const { borderBoxSize: b, target:
|
|
899
|
-
|
|
899
|
+
(a) => {
|
|
900
|
+
a.length !== 0 && a.forEach((u) => {
|
|
901
|
+
const { borderBoxSize: b, target: w } = u, I = w.getAttribute(te);
|
|
902
|
+
$(
|
|
900
903
|
I !== null,
|
|
901
904
|
`Invalid ${te} attribute value`
|
|
902
905
|
);
|
|
903
|
-
const
|
|
904
|
-
|
|
906
|
+
const x = parseInt(I), { blockSize: m } = b[0];
|
|
907
|
+
m && f(x, m);
|
|
905
908
|
});
|
|
906
909
|
}
|
|
907
|
-
), [c] =
|
|
910
|
+
), [c] = H(
|
|
908
911
|
() => new ResizeObserver(l)
|
|
909
912
|
);
|
|
910
913
|
J(() => () => {
|
|
911
914
|
c.disconnect();
|
|
912
915
|
}, [c]);
|
|
913
916
|
const d = U(
|
|
914
|
-
(
|
|
915
|
-
|
|
917
|
+
(a) => (a.forEach((u) => c.observe(u)), () => {
|
|
918
|
+
a.forEach((u) => c.unobserve(u));
|
|
916
919
|
}),
|
|
917
920
|
[c]
|
|
918
921
|
);
|
|
@@ -920,15 +923,15 @@ function ke({
|
|
|
920
923
|
() => ({
|
|
921
924
|
getAverageRowHeight: o,
|
|
922
925
|
getRowHeight: i,
|
|
923
|
-
setRowHeight:
|
|
926
|
+
setRowHeight: f,
|
|
924
927
|
observeRowElements: d
|
|
925
928
|
}),
|
|
926
|
-
[o, i,
|
|
929
|
+
[o, i, f, d]
|
|
927
930
|
);
|
|
928
931
|
}
|
|
929
|
-
const Le =
|
|
932
|
+
const Le = H, Me = K;
|
|
930
933
|
let C = -1;
|
|
931
|
-
function
|
|
934
|
+
function $e(e = !1) {
|
|
932
935
|
if (C === -1 || e) {
|
|
933
936
|
const t = document.createElement("div"), s = t.style;
|
|
934
937
|
s.width = "50px", s.height = "50px", s.overflow = "scroll", document.body.appendChild(t), C = t.offsetWidth - t.clientWidth, document.body.removeChild(t);
|
|
@@ -936,12 +939,12 @@ function He(e = !1) {
|
|
|
936
939
|
return C;
|
|
937
940
|
}
|
|
938
941
|
export {
|
|
939
|
-
|
|
942
|
+
Ve as Grid,
|
|
940
943
|
Ae as List,
|
|
941
|
-
|
|
944
|
+
$e as getScrollbarSize,
|
|
942
945
|
ke as useDynamicRowHeight,
|
|
943
|
-
|
|
944
|
-
|
|
946
|
+
Ee as useGridCallbackRef,
|
|
947
|
+
Re as useGridRef,
|
|
945
948
|
Le as useListCallbackRef,
|
|
946
949
|
Me as useListRef
|
|
947
950
|
};
|