@pinnacle0/web-ui 0.6.34 → 0.6.35
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.
|
@@ -27,4 +27,4 @@ export interface Props<T extends object> {
|
|
|
27
27
|
/**
|
|
28
28
|
* Efficiently rendering large lists and tabular data
|
|
29
29
|
*/
|
|
30
|
-
export declare function VirtualList<T extends object>({ data, rowKey, direction, renderItem: renderData, overscan, initialRect, fixedSize, id, className, }: Props<T>): React.JSX.Element;
|
|
30
|
+
export declare function VirtualList<T extends object>({ data, rowKey, direction, renderItem: renderData, overscan, initialRect, fixedSize, id, className, listRef, }: Props<T>): React.JSX.Element;
|
|
@@ -7,7 +7,7 @@ const DEFAULT_ITEM_SIZE = 100;
|
|
|
7
7
|
/**
|
|
8
8
|
* Efficiently rendering large lists and tabular data
|
|
9
9
|
*/
|
|
10
|
-
export function VirtualList({ data, rowKey = "index", direction = "vertical", renderItem: renderData, overscan = 5, initialRect = { width: 0, height: 0 }, fixedSize, id, className, }) {
|
|
10
|
+
export function VirtualList({ data, rowKey = "index", direction = "vertical", renderItem: renderData, overscan = 5, initialRect = { width: 0, height: 0 }, fixedSize, id, className, listRef, }) {
|
|
11
11
|
const Item = renderData;
|
|
12
12
|
const parentRef = React.useRef(null);
|
|
13
13
|
const horizontal = direction === "horizontal";
|
|
@@ -19,6 +19,7 @@ export function VirtualList({ data, rowKey = "index", direction = "vertical", re
|
|
|
19
19
|
estimateSize: fixedSize ?? (() => DEFAULT_ITEM_SIZE),
|
|
20
20
|
overscan,
|
|
21
21
|
});
|
|
22
|
+
React.useImperativeHandle(listRef, () => virtualizer);
|
|
22
23
|
const getItemKey = (index) => (rowKey === "index" ? index : data[index][rowKey]);
|
|
23
24
|
return (React.createElement("div", { id: id, className: classNames("g-virtual-list", className, { horizontal }), ref: parentRef },
|
|
24
25
|
React.createElement("div", { className: "g-virtual-list-inner", style: horizontal ? { width: virtualizer.getTotalSize() } : { height: virtualizer.getTotalSize() } }, virtualizer.getVirtualItems().map(virtualRow => (React.createElement("div", { className: "g-virtual-list-item", key: getItemKey(virtualRow.index), ref: virtualizer.measureElement, "data-index": virtualRow.index, style: { transform: horizontal ? `translateX(${virtualRow.start}px)` : `translateY(${virtualRow.start}px)` } },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VirtualList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAIvD,OAAO,cAAc,CAAC;AAEtB,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAsB9B;;GAEG;AACH,MAAM,UAAU,WAAW,CAAmB,EAC1C,IAAI,EACJ,MAAM,GAAG,OAAO,EAChB,SAAS,GAAG,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,GAAG,CAAC,EACZ,WAAW,GAAG,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,EACnC,SAAS,EACT,EAAE,EACF,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VirtualList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAIvD,OAAO,cAAc,CAAC;AAEtB,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAsB9B;;GAEG;AACH,MAAM,UAAU,WAAW,CAAmB,EAC1C,IAAI,EACJ,MAAM,GAAG,OAAO,EAChB,SAAS,GAAG,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,GAA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