@etsoo/react 1.7.38 → 1.7.39
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.
|
@@ -82,7 +82,7 @@ export interface GridLoader<T extends object> {
|
|
|
82
82
|
* @param ref Ref
|
|
83
83
|
* @returns Result
|
|
84
84
|
*/
|
|
85
|
-
onInitLoad?: (ref: any) => [T[],
|
|
85
|
+
onInitLoad?: (ref: any) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
86
86
|
/**
|
|
87
87
|
* Handler for updating rows
|
|
88
88
|
* @param rows Rows
|
package/package.json
CHANGED
|
@@ -125,7 +125,7 @@ export interface GridLoader<T extends object> {
|
|
|
125
125
|
*/
|
|
126
126
|
onInitLoad?: (
|
|
127
127
|
ref: any
|
|
128
|
-
) => [T[],
|
|
128
|
+
) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Handler for updating rows
|
|
@@ -7,7 +7,12 @@ import {
|
|
|
7
7
|
VariableSizeGrid,
|
|
8
8
|
VariableSizeGridProps
|
|
9
9
|
} from 'react-window';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
GridLoadDataProps,
|
|
12
|
+
GridLoader,
|
|
13
|
+
GridLoaderPartialStates,
|
|
14
|
+
GridLoaderStates
|
|
15
|
+
} from './GridLoader';
|
|
11
16
|
import { GridMethodRef } from './GridMethodRef';
|
|
12
17
|
|
|
13
18
|
export type ScrollerGridItemRendererProps<T> = Omit<
|
|
@@ -317,11 +322,10 @@ export const ScrollerGrid = <T extends object>(props: ScrollerGridProps<T>) => {
|
|
|
317
322
|
};
|
|
318
323
|
|
|
319
324
|
// Reset the state and load again
|
|
320
|
-
const reset = (add?:
|
|
325
|
+
const reset = (add?: GridLoaderPartialStates<T>, items: T[] = []) => {
|
|
321
326
|
const { queryPaging, ...rest } = add ?? {};
|
|
322
|
-
const resetState:
|
|
327
|
+
const resetState: GridLoaderPartialStates<T> = {
|
|
323
328
|
queryPaging: {
|
|
324
|
-
...refs.current.queryPaging,
|
|
325
329
|
currentPage: 0,
|
|
326
330
|
...queryPaging
|
|
327
331
|
},
|
|
@@ -12,6 +12,7 @@ import { useCombinedRefs } from '../uses/useCombinedRefs';
|
|
|
12
12
|
import {
|
|
13
13
|
GridLoadDataProps,
|
|
14
14
|
GridLoader,
|
|
15
|
+
GridLoaderPartialStates,
|
|
15
16
|
GridLoaderStates,
|
|
16
17
|
GridSizeGet
|
|
17
18
|
} from './GridLoader';
|
|
@@ -248,9 +249,9 @@ export const ScrollerList = <T extends object>(props: ScrollerListProps<T>) => {
|
|
|
248
249
|
};
|
|
249
250
|
|
|
250
251
|
// Reset the state and load again
|
|
251
|
-
const reset = (add?:
|
|
252
|
+
const reset = (add?: GridLoaderPartialStates<T>, items: T[] = []) => {
|
|
252
253
|
const { queryPaging, ...rest } = add ?? {};
|
|
253
|
-
const resetState:
|
|
254
|
+
const resetState: GridLoaderPartialStates<T> = {
|
|
254
255
|
queryPaging: {
|
|
255
256
|
...stateRefs.current.queryPaging,
|
|
256
257
|
currentPage: 0,
|