@rebasepro/ui 0.12.1-canary.g389e9b2 → 0.12.1-canary.g4e7bcbf
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/components/VirtualTable/VirtualTable.d.ts +12 -6
- package/dist/index.es.js +11 -5
- package/dist/index.es.js.map +1 -1
- package/dist/src/theme.css +16 -0
- package/dist/theme.css +16 -0
- package/package.json +1 -1
- package/src/components/VirtualTable/VirtualTable.performance.test.tsx +35 -341
- package/src/components/VirtualTable/VirtualTable.tsx +19 -1
- package/src/theme.css +16 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VirtualTableProps } from "./VirtualTableProps";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* `React.memo` is not generic-preserving: it takes the props type as its own
|
|
5
|
+
* type argument, so annotating the call with
|
|
6
|
+
* `VirtualTableProps<Record<string, unknown>>` pinned `T` at the boundary and
|
|
7
|
+
* discarded the `<T>` the inner function declares. The exported component was
|
|
8
|
+
* therefore not generic at all — every consumer got `Record<string, unknown>`,
|
|
9
|
+
* `columns` and `cellRenderer` were unrelated to `data`, and a caller writing
|
|
10
|
+
* `<VirtualTable<Post> …>` was told the component expects no type arguments.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
12
|
+
* Re-asserting the call signature is the standard way to carry a type parameter
|
|
13
|
+
* across `memo`; it is the only cast here, and it restores the generic the
|
|
14
|
+
* implementation always had. Runtime behaviour is unchanged — this is the same
|
|
15
|
+
* memoized component under a type that describes it.
|
|
10
16
|
*/
|
|
11
|
-
export declare const VirtualTable:
|
|
17
|
+
export declare const VirtualTable: <T extends Record<string, unknown>>(props: VirtualTableProps<T>) => React.ReactElement | null;
|
package/dist/index.es.js
CHANGED
|
@@ -5987,12 +5987,18 @@ var innerElementType = forwardRef(({ children, ...rest }, ref) => {
|
|
|
5987
5987
|
} });
|
|
5988
5988
|
});
|
|
5989
5989
|
/**
|
|
5990
|
-
*
|
|
5991
|
-
*
|
|
5992
|
-
*
|
|
5993
|
-
*
|
|
5990
|
+
* `React.memo` is not generic-preserving: it takes the props type as its own
|
|
5991
|
+
* type argument, so annotating the call with
|
|
5992
|
+
* `VirtualTableProps<Record<string, unknown>>` pinned `T` at the boundary and
|
|
5993
|
+
* discarded the `<T>` the inner function declares. The exported component was
|
|
5994
|
+
* therefore not generic at all — every consumer got `Record<string, unknown>`,
|
|
5995
|
+
* `columns` and `cellRenderer` were unrelated to `data`, and a caller writing
|
|
5996
|
+
* `<VirtualTable<Post> …>` was told the component expects no type arguments.
|
|
5994
5997
|
*
|
|
5995
|
-
*
|
|
5998
|
+
* Re-asserting the call signature is the standard way to carry a type parameter
|
|
5999
|
+
* across `memo`; it is the only cast here, and it restores the generic the
|
|
6000
|
+
* implementation always had. Runtime behaviour is unchanged — this is the same
|
|
6001
|
+
* memoized component under a type that describes it.
|
|
5996
6002
|
*/
|
|
5997
6003
|
var VirtualTable = React.memo(function VirtualTable({ data, onResetPagination, onEndReached, endOffset = 600, rowHeight = 54, headerHeight = 48, columns: columnsProp, onRowClick, onColumnResize, onColumnResizeEnd, filter: filterInput, checkFilterCombination, onFilterUpdate, sortBy, error, emptyComponent, onSortByUpdate, onScroll: onScrollProp, loading, cellRenderer, hoverRow, createFilterField, rowClassName, style, className, endAdornment, AddColumnComponent, initialScroll = 0, onColumnsOrderChange, extraData }) {
|
|
5998
6004
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|