@etsoo/react 1.7.28 → 1.7.30
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 +2 -2
- package/lib/components/ScrollerGrid.d.ts +5 -5
- package/lib/components/ScrollerList.d.ts +4 -4
- package/package.json +1 -1
- package/src/components/GridLoader.ts +2 -2
- package/src/components/ScrollerGrid.tsx +55 -62
- package/src/components/ScrollerList.tsx +6 -13
|
@@ -57,7 +57,7 @@ export type GridLoadDataProps = {
|
|
|
57
57
|
/**
|
|
58
58
|
* Grid data loader
|
|
59
59
|
*/
|
|
60
|
-
export
|
|
60
|
+
export interface GridLoader<T extends object> {
|
|
61
61
|
/**
|
|
62
62
|
* Auto load data, otherwise call reset
|
|
63
63
|
* @default true
|
|
@@ -91,7 +91,7 @@ export type GridLoader<T extends object> = {
|
|
|
91
91
|
* Threshold at which to pre-fetch data; default is half of loadBatchSize
|
|
92
92
|
*/
|
|
93
93
|
threshold?: number | undefined;
|
|
94
|
-
}
|
|
94
|
+
}
|
|
95
95
|
/**
|
|
96
96
|
* Grid loader states
|
|
97
97
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes
|
|
1
|
+
import { DataTypes } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Align, GridChildComponentProps, VariableSizeGridProps } from 'react-window';
|
|
4
4
|
import { GridLoader, GridLoaderStates } from './GridLoader';
|
|
@@ -21,7 +21,7 @@ export type ScrollerGridItemRendererProps<T> = Omit<GridChildComponentProps<T>,
|
|
|
21
21
|
/**
|
|
22
22
|
* Scroller vertical grid props
|
|
23
23
|
*/
|
|
24
|
-
export
|
|
24
|
+
export interface ScrollerGridProps<T extends object> extends GridLoader<T>, Omit<VariableSizeGridProps<T>, 'children' | 'rowCount' | 'rowHeight' | 'ref'> {
|
|
25
25
|
/**
|
|
26
26
|
* Default order by asc
|
|
27
27
|
* @default true
|
|
@@ -38,7 +38,7 @@ export type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T>> = G
|
|
|
38
38
|
/**
|
|
39
39
|
* Id field
|
|
40
40
|
*/
|
|
41
|
-
idField?:
|
|
41
|
+
idField?: DataTypes.Keys<T>;
|
|
42
42
|
/**
|
|
43
43
|
* Item renderer
|
|
44
44
|
*/
|
|
@@ -55,7 +55,7 @@ export type ScrollerGridProps<T extends object, D extends DataTypes.Keys<T>> = G
|
|
|
55
55
|
* Returns the height of the specified row.
|
|
56
56
|
*/
|
|
57
57
|
rowHeight?: ((index: number) => number) | number;
|
|
58
|
-
}
|
|
58
|
+
}
|
|
59
59
|
/**
|
|
60
60
|
* Scroller grid forward ref
|
|
61
61
|
*/
|
|
@@ -114,4 +114,4 @@ export interface ScrollerGridForwardRef<T> extends GridMethodRef<T> {
|
|
|
114
114
|
* @param props Props
|
|
115
115
|
* @returns Component
|
|
116
116
|
*/
|
|
117
|
-
export declare const ScrollerGrid: <T extends object
|
|
117
|
+
export declare const ScrollerGrid: <T extends object>(props: ScrollerGridProps<T>) => React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes
|
|
1
|
+
import { DataTypes } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Align, ListChildComponentProps, ListProps } from 'react-window';
|
|
4
4
|
import { GridLoader } from './GridLoader';
|
|
@@ -6,7 +6,7 @@ import { GridMethodRef } from './GridMethodRef';
|
|
|
6
6
|
/**
|
|
7
7
|
* Scroller vertical list props
|
|
8
8
|
*/
|
|
9
|
-
export interface ScrollerListProps<T extends object
|
|
9
|
+
export interface ScrollerListProps<T extends object> extends GridLoader<T>, Omit<ListProps<T>, 'ref' | 'outerRef' | 'height' | 'width' | 'children' | 'itemCount'> {
|
|
10
10
|
/**
|
|
11
11
|
* Default order by asc/desc
|
|
12
12
|
*/
|
|
@@ -30,7 +30,7 @@ export interface ScrollerListProps<T extends object, D extends DataTypes.Keys<T>
|
|
|
30
30
|
/**
|
|
31
31
|
* Id field
|
|
32
32
|
*/
|
|
33
|
-
idField?:
|
|
33
|
+
idField?: DataTypes.Keys<T>;
|
|
34
34
|
/**
|
|
35
35
|
* Item renderer
|
|
36
36
|
*/
|
|
@@ -67,4 +67,4 @@ export interface ScrollerListForwardRef<T> extends GridMethodRef<T> {
|
|
|
67
67
|
* @param props Props
|
|
68
68
|
* @returns Component
|
|
69
69
|
*/
|
|
70
|
-
export declare const ScrollerList: <T extends object
|
|
70
|
+
export declare const ScrollerList: <T extends object>(props: ScrollerListProps<T>) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -95,7 +95,7 @@ export type GridLoadDataProps = {
|
|
|
95
95
|
/**
|
|
96
96
|
* Grid data loader
|
|
97
97
|
*/
|
|
98
|
-
export
|
|
98
|
+
export interface GridLoader<T extends object> {
|
|
99
99
|
/**
|
|
100
100
|
* Auto load data, otherwise call reset
|
|
101
101
|
* @default true
|
|
@@ -137,7 +137,7 @@ export type GridLoader<T extends object> = {
|
|
|
137
137
|
* Threshold at which to pre-fetch data; default is half of loadBatchSize
|
|
138
138
|
*/
|
|
139
139
|
threshold?: number | undefined;
|
|
140
|
-
}
|
|
140
|
+
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* Grid loader states
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes
|
|
1
|
+
import { DataTypes } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
Align,
|
|
@@ -39,60 +39,58 @@ export type ScrollerGridItemRendererProps<T> = Omit<
|
|
|
39
39
|
/**
|
|
40
40
|
* Scroller vertical grid props
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
rowHeight?: ((index: number) => number) | number;
|
|
95
|
-
};
|
|
42
|
+
export interface ScrollerGridProps<T extends object>
|
|
43
|
+
extends GridLoader<T>,
|
|
44
|
+
Omit<
|
|
45
|
+
VariableSizeGridProps<T>,
|
|
46
|
+
'children' | 'rowCount' | 'rowHeight' | 'ref'
|
|
47
|
+
> {
|
|
48
|
+
/**
|
|
49
|
+
* Default order by asc
|
|
50
|
+
* @default true
|
|
51
|
+
*/
|
|
52
|
+
defaultOrderByAsc?: boolean;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Footer renderer
|
|
56
|
+
*/
|
|
57
|
+
footerRenderer?: (
|
|
58
|
+
rows: T[],
|
|
59
|
+
states: GridLoaderStates<T>
|
|
60
|
+
) => React.ReactNode;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Header renderer
|
|
64
|
+
*/
|
|
65
|
+
headerRenderer?: (states: GridLoaderStates<T>) => React.ReactNode;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Id field
|
|
69
|
+
*/
|
|
70
|
+
idField?: DataTypes.Keys<T>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Item renderer
|
|
74
|
+
*/
|
|
75
|
+
itemRenderer: (
|
|
76
|
+
props: ScrollerGridItemRendererProps<T>
|
|
77
|
+
) => React.ReactElement;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Methods
|
|
81
|
+
*/
|
|
82
|
+
mRef?: React.Ref<ScrollerGridForwardRef<T>>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* On items select change
|
|
86
|
+
*/
|
|
87
|
+
onSelectChange?: (selectedItems: T[]) => void;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns the height of the specified row.
|
|
91
|
+
*/
|
|
92
|
+
rowHeight?: ((index: number) => number) | number;
|
|
93
|
+
}
|
|
96
94
|
|
|
97
95
|
/**
|
|
98
96
|
* Scroller grid forward ref
|
|
@@ -158,12 +156,7 @@ export interface ScrollerGridForwardRef<T> extends GridMethodRef<T> {
|
|
|
158
156
|
* @param props Props
|
|
159
157
|
* @returns Component
|
|
160
158
|
*/
|
|
161
|
-
export const ScrollerGrid = <
|
|
162
|
-
T extends object,
|
|
163
|
-
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
164
|
-
>(
|
|
165
|
-
props: ScrollerGridProps<T, D>
|
|
166
|
-
) => {
|
|
159
|
+
export const ScrollerGrid = <T extends object>(props: ScrollerGridProps<T>) => {
|
|
167
160
|
// Destruct
|
|
168
161
|
const {
|
|
169
162
|
autoLoad = true,
|
|
@@ -172,7 +165,7 @@ export const ScrollerGrid = <
|
|
|
172
165
|
footerRenderer,
|
|
173
166
|
headerRenderer,
|
|
174
167
|
itemRenderer,
|
|
175
|
-
idField = 'id' as
|
|
168
|
+
idField = 'id' as DataTypes.Keys<T>,
|
|
176
169
|
loadBatchSize,
|
|
177
170
|
loadData,
|
|
178
171
|
mRef,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes,
|
|
1
|
+
import { DataTypes, Utils } from '@etsoo/shared';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
Align,
|
|
@@ -20,10 +20,8 @@ import { GridMethodRef } from './GridMethodRef';
|
|
|
20
20
|
/**
|
|
21
21
|
* Scroller vertical list props
|
|
22
22
|
*/
|
|
23
|
-
export interface ScrollerListProps<
|
|
24
|
-
|
|
25
|
-
D extends DataTypes.Keys<T>
|
|
26
|
-
> extends GridLoader<T>,
|
|
23
|
+
export interface ScrollerListProps<T extends object>
|
|
24
|
+
extends GridLoader<T>,
|
|
27
25
|
Omit<
|
|
28
26
|
ListProps<T>,
|
|
29
27
|
'ref' | 'outerRef' | 'height' | 'width' | 'children' | 'itemCount'
|
|
@@ -56,7 +54,7 @@ export interface ScrollerListProps<
|
|
|
56
54
|
/**
|
|
57
55
|
* Id field
|
|
58
56
|
*/
|
|
59
|
-
idField?:
|
|
57
|
+
idField?: DataTypes.Keys<T>;
|
|
60
58
|
|
|
61
59
|
/**
|
|
62
60
|
* Item renderer
|
|
@@ -108,12 +106,7 @@ const calculateBatchSize = (
|
|
|
108
106
|
* @param props Props
|
|
109
107
|
* @returns Component
|
|
110
108
|
*/
|
|
111
|
-
export const ScrollerList = <
|
|
112
|
-
T extends object,
|
|
113
|
-
D extends DataTypes.Keys<T> = IdDefaultType<T>
|
|
114
|
-
>(
|
|
115
|
-
props: ScrollerListProps<T, D>
|
|
116
|
-
) => {
|
|
109
|
+
export const ScrollerList = <T extends object>(props: ScrollerListProps<T>) => {
|
|
117
110
|
// Destruct
|
|
118
111
|
const {
|
|
119
112
|
autoLoad = true,
|
|
@@ -124,7 +117,7 @@ export const ScrollerList = <
|
|
|
124
117
|
mRef,
|
|
125
118
|
oRef,
|
|
126
119
|
style = {},
|
|
127
|
-
idField = 'id' as
|
|
120
|
+
idField = 'id' as DataTypes.Keys<T>,
|
|
128
121
|
itemRenderer,
|
|
129
122
|
itemSize,
|
|
130
123
|
loadBatchSize = calculateBatchSize(height, itemSize),
|