Skip to content

Commit

Permalink
Refactor loadData of GridLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
garryxiao committed Dec 6, 2024
1 parent 3830b88 commit b22c3bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etsoo/react",
"version": "1.8.12",
"version": "1.8.13",
"description": "TypeScript ReactJs UI Independent Framework",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
22 changes: 11 additions & 11 deletions src/components/GridLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,17 @@ export function GridDataGetData<const T>(
/**
* Grid Json data
*/
export type GridJsonData = Omit<GridLoadDataProps, "data">;

/**
* Grid data load props
*/
export type GridLoadDataProps = {
export type GridJsonData = {
/**
* Query paging data
*/
queryPaging: QueryPagingData;
};

/**
* Grid data load props
*/
export type GridLoadDataProps = GridJsonData & {
/**
* Data related
*/
Expand All @@ -116,7 +116,10 @@ export type GridLoadDataPartialProps = {
/**
* Grid data loader
*/
export type GridLoader<T extends object> = {
export type GridLoader<
T extends object,
P extends GridJsonData = GridLoadDataProps
> = {
/**
* Auto load data, otherwise call reset
* @default true
Expand All @@ -136,10 +139,7 @@ export type GridLoader<T extends object> = {
/**
* Load data
*/
loadData: (
props: GridLoadDataProps,
lastItem?: T
) => PromiseLike<T[] | null | undefined>;
loadData: (props: P, lastItem?: T) => PromiseLike<T[] | null | undefined>;

/**
* Handler for init load
Expand Down

0 comments on commit b22c3bb

Please sign in to comment.