@etsoo/react 1.8.53 → 1.8.55
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/cjs/components/GridLoader.d.ts +0 -6
- package/lib/cjs/components/ScrollerGrid.d.ts +11 -2
- package/lib/cjs/components/ScrollerGrid.js +3 -1
- package/lib/cjs/components/ScrollerList.d.ts +8 -2
- package/lib/cjs/components/ScrollerList.js +3 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/mjs/components/GridLoader.d.ts +0 -6
- package/lib/mjs/components/ScrollerGrid.d.ts +11 -2
- package/lib/mjs/components/ScrollerGrid.js +3 -1
- package/lib/mjs/components/ScrollerList.d.ts +8 -2
- package/lib/mjs/components/ScrollerList.js +3 -1
- package/lib/mjs/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/GridLoader.ts +0 -9
- package/src/components/ScrollerGrid.tsx +16 -2
- package/src/components/ScrollerList.tsx +13 -2
- package/src/index.ts +3 -0
|
@@ -88,12 +88,6 @@ export type GridLoader<T extends object, P extends GridJsonData = GridLoadDataPr
|
|
|
88
88
|
* Load data
|
|
89
89
|
*/
|
|
90
90
|
loadData: (props: P, lastItem?: T) => PromiseLike<T[] | null | undefined>;
|
|
91
|
-
/**
|
|
92
|
-
* Handler for init load
|
|
93
|
-
* @param ref Ref
|
|
94
|
-
* @returns Result
|
|
95
|
-
*/
|
|
96
|
-
onInitLoad?: (ref: any) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
97
91
|
/**
|
|
98
92
|
* Handler for updating rows
|
|
99
93
|
* @param rows Rows
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { DataTypes } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { GridProps } from "react-window";
|
|
4
|
-
import { GridJsonData, GridLoadDataProps, GridLoader, GridLoaderStates } from "./GridLoader";
|
|
3
|
+
import { GridImperativeAPI, GridProps } from "react-window";
|
|
4
|
+
import { GridJsonData, GridLoadDataProps, GridLoader, GridLoaderPartialStates, GridLoaderStates } from "./GridLoader";
|
|
5
5
|
import { GridMethodRef, ScrollToRowParam } from "./GridMethodRef";
|
|
6
6
|
type ScrollerGridCellrops<T extends object> = {
|
|
7
7
|
rows: T[];
|
|
8
8
|
states: GridLoaderStates<T>;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Scroller grid forward params
|
|
12
|
+
*/
|
|
10
13
|
export type ScrollToCellParam = {
|
|
11
14
|
behavior?: ScrollToRowParam["behavior"];
|
|
12
15
|
columnAlign?: ScrollToRowParam["align"];
|
|
@@ -38,6 +41,12 @@ export type ScrollerGridProps<T extends object, P extends GridJsonData = GridLoa
|
|
|
38
41
|
* Methods
|
|
39
42
|
*/
|
|
40
43
|
mRef?: React.Ref<ScrollerGridForwardRef<T>>;
|
|
44
|
+
/**
|
|
45
|
+
* Handler for init load
|
|
46
|
+
* @param ref Ref
|
|
47
|
+
* @returns Result
|
|
48
|
+
*/
|
|
49
|
+
onInitLoad?: (ref: GridImperativeAPI) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
41
50
|
/**
|
|
42
51
|
* On items select change
|
|
43
52
|
*/
|
|
@@ -198,7 +198,9 @@ const ScrollerGrid = (props) => {
|
|
|
198
198
|
// Auto load data when current page is 0
|
|
199
199
|
if (stateRefs.current.queryPaging.currentPage === 0 &&
|
|
200
200
|
stateRefs.current.autoLoad) {
|
|
201
|
-
const initItems = onInitLoad == null
|
|
201
|
+
const initItems = onInitLoad == null || localRef.current == null
|
|
202
|
+
? undefined
|
|
203
|
+
: onInitLoad(localRef.current);
|
|
202
204
|
if (initItems)
|
|
203
205
|
reset(initItems[1], initItems[0]);
|
|
204
206
|
else
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataTypes } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { ListProps } from "react-window";
|
|
4
|
-
import { GridLoader } from "./GridLoader";
|
|
3
|
+
import { ListImperativeAPI, ListProps } from "react-window";
|
|
4
|
+
import { GridLoader, GridLoaderPartialStates } from "./GridLoader";
|
|
5
5
|
import { GridMethodRef } from "./GridMethodRef";
|
|
6
6
|
type ScrollerListRowProps<T extends object> = {
|
|
7
7
|
items: T[];
|
|
@@ -27,6 +27,12 @@ export type ScrollerListProps<T extends object> = GridLoader<T> & Omit<ListProps
|
|
|
27
27
|
* Methods ref
|
|
28
28
|
*/
|
|
29
29
|
mRef?: React.Ref<ScrollerListForwardRef<T>>;
|
|
30
|
+
/**
|
|
31
|
+
* Handler for init load
|
|
32
|
+
* @param ref Ref
|
|
33
|
+
* @returns Result
|
|
34
|
+
*/
|
|
35
|
+
onInitLoad?: (ref: ListImperativeAPI) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
30
36
|
/**
|
|
31
37
|
* Width of the list
|
|
32
38
|
*/
|
|
@@ -168,7 +168,9 @@ const ScrollerList = (props) => {
|
|
|
168
168
|
// Auto load data when current page is 0
|
|
169
169
|
if (stateRefs.current.queryPaging?.currentPage === 0 &&
|
|
170
170
|
stateRefs.current.autoLoad) {
|
|
171
|
-
const initItems = onInitLoad == null
|
|
171
|
+
const initItems = onInitLoad == null || localRef.current == null
|
|
172
|
+
? undefined
|
|
173
|
+
: onInitLoad(localRef.current);
|
|
172
174
|
if (initItems)
|
|
173
175
|
reset(initItems[1], initItems[0]);
|
|
174
176
|
else
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -88,12 +88,6 @@ export type GridLoader<T extends object, P extends GridJsonData = GridLoadDataPr
|
|
|
88
88
|
* Load data
|
|
89
89
|
*/
|
|
90
90
|
loadData: (props: P, lastItem?: T) => PromiseLike<T[] | null | undefined>;
|
|
91
|
-
/**
|
|
92
|
-
* Handler for init load
|
|
93
|
-
* @param ref Ref
|
|
94
|
-
* @returns Result
|
|
95
|
-
*/
|
|
96
|
-
onInitLoad?: (ref: any) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
97
91
|
/**
|
|
98
92
|
* Handler for updating rows
|
|
99
93
|
* @param rows Rows
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { DataTypes } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { GridProps } from "react-window";
|
|
4
|
-
import { GridJsonData, GridLoadDataProps, GridLoader, GridLoaderStates } from "./GridLoader";
|
|
3
|
+
import { GridImperativeAPI, GridProps } from "react-window";
|
|
4
|
+
import { GridJsonData, GridLoadDataProps, GridLoader, GridLoaderPartialStates, GridLoaderStates } from "./GridLoader";
|
|
5
5
|
import { GridMethodRef, ScrollToRowParam } from "./GridMethodRef";
|
|
6
6
|
type ScrollerGridCellrops<T extends object> = {
|
|
7
7
|
rows: T[];
|
|
8
8
|
states: GridLoaderStates<T>;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Scroller grid forward params
|
|
12
|
+
*/
|
|
10
13
|
export type ScrollToCellParam = {
|
|
11
14
|
behavior?: ScrollToRowParam["behavior"];
|
|
12
15
|
columnAlign?: ScrollToRowParam["align"];
|
|
@@ -38,6 +41,12 @@ export type ScrollerGridProps<T extends object, P extends GridJsonData = GridLoa
|
|
|
38
41
|
* Methods
|
|
39
42
|
*/
|
|
40
43
|
mRef?: React.Ref<ScrollerGridForwardRef<T>>;
|
|
44
|
+
/**
|
|
45
|
+
* Handler for init load
|
|
46
|
+
* @param ref Ref
|
|
47
|
+
* @returns Result
|
|
48
|
+
*/
|
|
49
|
+
onInitLoad?: (ref: GridImperativeAPI) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
41
50
|
/**
|
|
42
51
|
* On items select change
|
|
43
52
|
*/
|
|
@@ -192,7 +192,9 @@ export const ScrollerGrid = (props) => {
|
|
|
192
192
|
// Auto load data when current page is 0
|
|
193
193
|
if (stateRefs.current.queryPaging.currentPage === 0 &&
|
|
194
194
|
stateRefs.current.autoLoad) {
|
|
195
|
-
const initItems = onInitLoad == null
|
|
195
|
+
const initItems = onInitLoad == null || localRef.current == null
|
|
196
|
+
? undefined
|
|
197
|
+
: onInitLoad(localRef.current);
|
|
196
198
|
if (initItems)
|
|
197
199
|
reset(initItems[1], initItems[0]);
|
|
198
200
|
else
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataTypes } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { ListProps } from "react-window";
|
|
4
|
-
import { GridLoader } from "./GridLoader";
|
|
3
|
+
import { ListImperativeAPI, ListProps } from "react-window";
|
|
4
|
+
import { GridLoader, GridLoaderPartialStates } from "./GridLoader";
|
|
5
5
|
import { GridMethodRef } from "./GridMethodRef";
|
|
6
6
|
type ScrollerListRowProps<T extends object> = {
|
|
7
7
|
items: T[];
|
|
@@ -27,6 +27,12 @@ export type ScrollerListProps<T extends object> = GridLoader<T> & Omit<ListProps
|
|
|
27
27
|
* Methods ref
|
|
28
28
|
*/
|
|
29
29
|
mRef?: React.Ref<ScrollerListForwardRef<T>>;
|
|
30
|
+
/**
|
|
31
|
+
* Handler for init load
|
|
32
|
+
* @param ref Ref
|
|
33
|
+
* @returns Result
|
|
34
|
+
*/
|
|
35
|
+
onInitLoad?: (ref: ListImperativeAPI) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
30
36
|
/**
|
|
31
37
|
* Width of the list
|
|
32
38
|
*/
|
|
@@ -162,7 +162,9 @@ export const ScrollerList = (props) => {
|
|
|
162
162
|
// Auto load data when current page is 0
|
|
163
163
|
if (stateRefs.current.queryPaging?.currentPage === 0 &&
|
|
164
164
|
stateRefs.current.autoLoad) {
|
|
165
|
-
const initItems = onInitLoad == null
|
|
165
|
+
const initItems = onInitLoad == null || localRef.current == null
|
|
166
|
+
? undefined
|
|
167
|
+
: onInitLoad(localRef.current);
|
|
166
168
|
if (initItems)
|
|
167
169
|
reset(initItems[1], initItems[0]);
|
|
168
170
|
else
|
package/lib/mjs/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.55",
|
|
4
4
|
"description": "TypeScript ReactJs UI Independent Framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@etsoo/shared": "^1.2.76",
|
|
44
44
|
"react": "^19.1.1",
|
|
45
45
|
"react-dom": "^19.1.1",
|
|
46
|
-
"react-router-dom": "^7.9.
|
|
47
|
-
"react-window": "^2.1.
|
|
46
|
+
"react-router-dom": "^7.9.3",
|
|
47
|
+
"react-window": "^2.1.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@babel/cli": "^7.28.3",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
55
55
|
"@testing-library/jest-dom": "^6.8.0",
|
|
56
56
|
"@testing-library/react": "^16.3.0",
|
|
57
|
-
"@types/react": "^19.1.
|
|
57
|
+
"@types/react": "^19.1.15",
|
|
58
58
|
"@types/react-dom": "^19.1.9",
|
|
59
59
|
"@types/react-window": "^2.0.0",
|
|
60
|
-
"@vitejs/plugin-react": "^5.0.
|
|
60
|
+
"@vitejs/plugin-react": "^5.0.4",
|
|
61
61
|
"jsdom": "^27.0.0",
|
|
62
62
|
"typescript": "^5.9.2",
|
|
63
63
|
"vitest": "^3.2.4"
|
|
@@ -141,15 +141,6 @@ export type GridLoader<
|
|
|
141
141
|
*/
|
|
142
142
|
loadData: (props: P, lastItem?: T) => PromiseLike<T[] | null | undefined>;
|
|
143
143
|
|
|
144
|
-
/**
|
|
145
|
-
* Handler for init load
|
|
146
|
-
* @param ref Ref
|
|
147
|
-
* @returns Result
|
|
148
|
-
*/
|
|
149
|
-
onInitLoad?: (
|
|
150
|
-
ref: any
|
|
151
|
-
) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
152
|
-
|
|
153
144
|
/**
|
|
154
145
|
* Handler for updating rows
|
|
155
146
|
* @param rows Rows
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataTypes } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { Grid, GridProps, useGridRef } from "react-window";
|
|
3
|
+
import { Grid, GridImperativeAPI, GridProps, useGridRef } from "react-window";
|
|
4
4
|
import {
|
|
5
5
|
GridJsonData,
|
|
6
6
|
GridLoadDataProps,
|
|
@@ -16,6 +16,9 @@ type ScrollerGridCellrops<T extends object> = {
|
|
|
16
16
|
states: GridLoaderStates<T>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Scroller grid forward params
|
|
21
|
+
*/
|
|
19
22
|
export type ScrollToCellParam = {
|
|
20
23
|
behavior?: ScrollToRowParam["behavior"];
|
|
21
24
|
columnAlign?: ScrollToRowParam["align"];
|
|
@@ -63,6 +66,15 @@ export type ScrollerGridProps<
|
|
|
63
66
|
*/
|
|
64
67
|
mRef?: React.Ref<ScrollerGridForwardRef<T>>;
|
|
65
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Handler for init load
|
|
71
|
+
* @param ref Ref
|
|
72
|
+
* @returns Result
|
|
73
|
+
*/
|
|
74
|
+
onInitLoad?: (
|
|
75
|
+
ref: GridImperativeAPI
|
|
76
|
+
) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
77
|
+
|
|
66
78
|
/**
|
|
67
79
|
* On items select change
|
|
68
80
|
*/
|
|
@@ -352,7 +364,9 @@ export const ScrollerGrid = <T extends object>(props: ScrollerGridProps<T>) => {
|
|
|
352
364
|
stateRefs.current.autoLoad
|
|
353
365
|
) {
|
|
354
366
|
const initItems =
|
|
355
|
-
onInitLoad == null
|
|
367
|
+
onInitLoad == null || localRef.current == null
|
|
368
|
+
? undefined
|
|
369
|
+
: onInitLoad(localRef.current);
|
|
356
370
|
if (initItems) reset(initItems[1], initItems[0]);
|
|
357
371
|
else loadDataLocal();
|
|
358
372
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataTypes, Utils } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { List, ListProps, useListRef } from "react-window";
|
|
3
|
+
import { List, ListImperativeAPI, ListProps, useListRef } from "react-window";
|
|
4
4
|
import { useCombinedRefs } from "../uses/useCombinedRefs";
|
|
5
5
|
import {
|
|
6
6
|
GridLoadDataProps,
|
|
@@ -42,6 +42,15 @@ export type ScrollerListProps<T extends object> = GridLoader<T> &
|
|
|
42
42
|
*/
|
|
43
43
|
mRef?: React.Ref<ScrollerListForwardRef<T>>;
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Handler for init load
|
|
47
|
+
* @param ref Ref
|
|
48
|
+
* @returns Result
|
|
49
|
+
*/
|
|
50
|
+
onInitLoad?: (
|
|
51
|
+
ref: ListImperativeAPI
|
|
52
|
+
) => [T[], GridLoaderPartialStates<T>?] | null | undefined;
|
|
53
|
+
|
|
45
54
|
/**
|
|
46
55
|
* Width of the list
|
|
47
56
|
*/
|
|
@@ -262,7 +271,9 @@ export const ScrollerList = <T extends object>(props: ScrollerListProps<T>) => {
|
|
|
262
271
|
stateRefs.current.autoLoad
|
|
263
272
|
) {
|
|
264
273
|
const initItems =
|
|
265
|
-
onInitLoad == null
|
|
274
|
+
onInitLoad == null || localRef.current == null
|
|
275
|
+
? undefined
|
|
276
|
+
: onInitLoad(localRef.current);
|
|
266
277
|
if (initItems) reset(initItems[1], initItems[0]);
|
|
267
278
|
else loadDataLocal();
|
|
268
279
|
}
|
package/src/index.ts
CHANGED
|
@@ -42,3 +42,6 @@ export * from "./uses/useSearchParamsWithCache";
|
|
|
42
42
|
export * from "./uses/useTimeout";
|
|
43
43
|
export * from "./uses/useWindowScroll";
|
|
44
44
|
export * from "./uses/useWindowSize";
|
|
45
|
+
|
|
46
|
+
// react-window
|
|
47
|
+
export type { GridImperativeAPI, ListImperativeAPI } from "react-window";
|