@etsoo/react 1.7.37 → 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.
- package/lib/components/GridLoader.d.ts +24 -5
- package/lib/components/GridMethodRef.d.ts +2 -2
- package/lib/components/ScrollerGrid.js +0 -1
- package/package.json +2 -2
- package/src/components/GridLoader.ts +28 -5
- package/src/components/GridMethodRef.ts +2 -2
- package/src/components/ScrollerGrid.tsx +8 -4
- package/src/components/ScrollerList.tsx +3 -2
|
@@ -43,6 +43,19 @@ export type GridLoadDataProps = {
|
|
|
43
43
|
*/
|
|
44
44
|
data?: GridData;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Grid data load partial props
|
|
48
|
+
*/
|
|
49
|
+
export type GridLoadDataPartialProps = {
|
|
50
|
+
/**
|
|
51
|
+
* Query paging data
|
|
52
|
+
*/
|
|
53
|
+
queryPaging?: Partial<QueryPagingData>;
|
|
54
|
+
/**
|
|
55
|
+
* Data related
|
|
56
|
+
*/
|
|
57
|
+
data?: GridData;
|
|
58
|
+
};
|
|
46
59
|
/**
|
|
47
60
|
* Grid data loader
|
|
48
61
|
*/
|
|
@@ -69,7 +82,7 @@ export interface GridLoader<T extends object> {
|
|
|
69
82
|
* @param ref Ref
|
|
70
83
|
* @returns Result
|
|
71
84
|
*/
|
|
72
|
-
onInitLoad?: (ref: any) => [T[],
|
|
85
|
+
onInitLoad?: (ref: any) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
73
86
|
/**
|
|
74
87
|
* Handler for updating rows
|
|
75
88
|
* @param rows Rows
|
|
@@ -81,10 +94,7 @@ export interface GridLoader<T extends object> {
|
|
|
81
94
|
*/
|
|
82
95
|
threshold?: number | undefined;
|
|
83
96
|
}
|
|
84
|
-
|
|
85
|
-
* Grid loader states
|
|
86
|
-
*/
|
|
87
|
-
export type GridLoaderStates<T> = GridLoadDataProps & {
|
|
97
|
+
type GridLoaderProps<T> = {
|
|
88
98
|
/**
|
|
89
99
|
* Auto load data, otherwise call reset
|
|
90
100
|
* @default true
|
|
@@ -119,3 +129,12 @@ export type GridLoaderStates<T> = GridLoadDataProps & {
|
|
|
119
129
|
*/
|
|
120
130
|
idCache: Record<any, null>;
|
|
121
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* Grid loader states
|
|
134
|
+
*/
|
|
135
|
+
export type GridLoaderStates<T> = GridLoadDataProps & GridLoaderProps<T>;
|
|
136
|
+
/**
|
|
137
|
+
* Grid loader states
|
|
138
|
+
*/
|
|
139
|
+
export type GridLoaderPartialStates<T> = GridLoadDataPartialProps & Partial<GridLoaderProps<T>>;
|
|
140
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Align } from 'react-window';
|
|
2
|
-
import {
|
|
2
|
+
import { GridLoaderPartialStates } from './GridLoader';
|
|
3
3
|
/**
|
|
4
4
|
* Grid method ref
|
|
5
5
|
*/
|
|
@@ -19,7 +19,7 @@ export interface GridMethodRef<T> {
|
|
|
19
19
|
* Reset
|
|
20
20
|
* @param add Additional data
|
|
21
21
|
*/
|
|
22
|
-
reset(add?:
|
|
22
|
+
reset(add?: GridLoaderPartialStates<T>): void;
|
|
23
23
|
/**
|
|
24
24
|
* Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop).
|
|
25
25
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.39",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/css": "^11.11.2",
|
|
51
51
|
"@emotion/react": "^11.11.4",
|
|
52
52
|
"@emotion/styled": "^11.11.5",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
53
|
+
"@etsoo/appscript": "^1.4.86",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.42",
|
|
55
55
|
"@etsoo/shared": "^1.2.37",
|
|
56
56
|
"react": "^18.3.1",
|
|
@@ -78,6 +78,21 @@ export type GridLoadDataProps = {
|
|
|
78
78
|
data?: GridData;
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Grid data load partial props
|
|
83
|
+
*/
|
|
84
|
+
export type GridLoadDataPartialProps = {
|
|
85
|
+
/**
|
|
86
|
+
* Query paging data
|
|
87
|
+
*/
|
|
88
|
+
queryPaging?: Partial<QueryPagingData>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Data related
|
|
92
|
+
*/
|
|
93
|
+
data?: GridData;
|
|
94
|
+
};
|
|
95
|
+
|
|
81
96
|
/**
|
|
82
97
|
* Grid data loader
|
|
83
98
|
*/
|
|
@@ -110,7 +125,7 @@ export interface GridLoader<T extends object> {
|
|
|
110
125
|
*/
|
|
111
126
|
onInitLoad?: (
|
|
112
127
|
ref: any
|
|
113
|
-
) => [T[],
|
|
128
|
+
) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
114
129
|
|
|
115
130
|
/**
|
|
116
131
|
* Handler for updating rows
|
|
@@ -125,10 +140,7 @@ export interface GridLoader<T extends object> {
|
|
|
125
140
|
threshold?: number | undefined;
|
|
126
141
|
}
|
|
127
142
|
|
|
128
|
-
|
|
129
|
-
* Grid loader states
|
|
130
|
-
*/
|
|
131
|
-
export type GridLoaderStates<T> = GridLoadDataProps & {
|
|
143
|
+
type GridLoaderProps<T> = {
|
|
132
144
|
/**
|
|
133
145
|
* Auto load data, otherwise call reset
|
|
134
146
|
* @default true
|
|
@@ -170,3 +182,14 @@ export type GridLoaderStates<T> = GridLoadDataProps & {
|
|
|
170
182
|
*/
|
|
171
183
|
idCache: Record<any, null>;
|
|
172
184
|
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Grid loader states
|
|
188
|
+
*/
|
|
189
|
+
export type GridLoaderStates<T> = GridLoadDataProps & GridLoaderProps<T>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Grid loader states
|
|
193
|
+
*/
|
|
194
|
+
export type GridLoaderPartialStates<T> = GridLoadDataPartialProps &
|
|
195
|
+
Partial<GridLoaderProps<T>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Align } from 'react-window';
|
|
2
|
-
import {
|
|
2
|
+
import { GridLoaderPartialStates } from './GridLoader';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Grid method ref
|
|
@@ -22,7 +22,7 @@ export interface GridMethodRef<T> {
|
|
|
22
22
|
* Reset
|
|
23
23
|
* @param add Additional data
|
|
24
24
|
*/
|
|
25
|
-
reset(add?:
|
|
25
|
+
reset(add?: GridLoaderPartialStates<T>): void;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Scroll to the specified offset (scrollTop or scrollLeft, depending on the direction prop).
|
|
@@ -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,
|