virtua 0.16.2 → 0.16.4
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 +34 -26
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/react/VGrid.d.ts +1 -1
- package/lib/react/VList.d.ts +9 -3
- package/lib/react/WVList.d.ts +9 -3
- package/lib/react/useChildren.d.ts +3 -0
- package/lib/react/utils.d.ts +1 -2
- package/package.json +1 -1
package/lib/react/VGrid.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export interface VGridProps extends ViewportComponentAttributes {
|
|
|
80
80
|
*/
|
|
81
81
|
cellWidth?: number;
|
|
82
82
|
/**
|
|
83
|
-
* Number of items to render above/below the visible bounds of the grid.
|
|
83
|
+
* Number of items to render above/below the visible bounds of the grid. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
|
|
84
84
|
* @defaultValue 2
|
|
85
85
|
*/
|
|
86
86
|
overscan?: number;
|
package/lib/react/VList.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { CustomViewportComponent, ViewportComponentAttributes } from "./Viewport";
|
|
3
3
|
import { CustomItemComponent } from "./ListItem";
|
|
4
4
|
import { CacheSnapshot, ScrollToIndexOpts } from "../core/types";
|
|
@@ -46,10 +46,16 @@ export interface VListHandle {
|
|
|
46
46
|
export interface VListProps extends ViewportComponentAttributes {
|
|
47
47
|
/**
|
|
48
48
|
* Elements rendered by this component.
|
|
49
|
+
*
|
|
50
|
+
* You can also pass a function and set {@link VListProps.count} to create elements lazily.
|
|
51
|
+
*/
|
|
52
|
+
children: ReactNode | ((index: number) => ReactElement);
|
|
53
|
+
/**
|
|
54
|
+
* If you set a function to {@link VListProps.children}, you have to set total number of items to this prop.
|
|
49
55
|
*/
|
|
50
|
-
|
|
56
|
+
count?: number;
|
|
51
57
|
/**
|
|
52
|
-
* Number of items to render above/below the visible bounds of the list.
|
|
58
|
+
* Number of items to render above/below the visible bounds of the list. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
|
|
53
59
|
* @defaultValue 4
|
|
54
60
|
*/
|
|
55
61
|
overscan?: number;
|
package/lib/react/WVList.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
import { CacheSnapshot } from "../core/types";
|
|
3
3
|
import { CustomViewportComponent, ViewportComponentAttributes } from "./Viewport";
|
|
4
4
|
import { CustomItemComponent } from "./ListItem";
|
|
@@ -18,10 +18,16 @@ export interface WVListHandle {
|
|
|
18
18
|
export interface WVListProps extends ViewportComponentAttributes {
|
|
19
19
|
/**
|
|
20
20
|
* Elements rendered by this component.
|
|
21
|
+
*
|
|
22
|
+
* You can also pass a function and set {@link WVListProps.count} to create elements lazily.
|
|
23
|
+
*/
|
|
24
|
+
children: ReactNode | ((index: number) => ReactElement);
|
|
25
|
+
/**
|
|
26
|
+
* If you set a function to {@link WVListProps.children}, you have to set total number of items to this prop.
|
|
21
27
|
*/
|
|
22
|
-
|
|
28
|
+
count?: number;
|
|
23
29
|
/**
|
|
24
|
-
* Number of items to render above/below the visible bounds of the list.
|
|
30
|
+
* Number of items to render above/below the visible bounds of the list. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
|
|
25
31
|
* @defaultValue 4
|
|
26
32
|
*/
|
|
27
33
|
overscan?: number;
|
package/lib/react/utils.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ import { ReactElement, ReactFragment, ReactNode } from "react";
|
|
|
2
2
|
import { ScrollDirection } from "../core/store";
|
|
3
3
|
export declare const refKey = "current";
|
|
4
4
|
export declare const emptyComponents: {};
|
|
5
|
-
type ItemElement = ReactElement | ReactFragment | string | number;
|
|
5
|
+
export type ItemElement = ReactElement | ReactFragment | string | number;
|
|
6
6
|
export declare const flattenChildren: (children: ReactNode) => ItemElement[];
|
|
7
7
|
export type MayHaveKey = {
|
|
8
8
|
key?: React.Key;
|
|
9
9
|
};
|
|
10
10
|
export declare const clampStartIndex: (startIndex: number, overscan: number, scrollDirection: ScrollDirection) => number;
|
|
11
11
|
export declare const clampEndIndex: (endIndex: number, overscan: number, scrollDirection: ScrollDirection, count: number) => number;
|
|
12
|
-
export {};
|