@etsoo/react 1.6.81 → 1.6.82
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.
|
@@ -10,10 +10,10 @@ export const ScrollerGrid = (props) => {
|
|
|
10
10
|
const { autoLoad = true, defaultOrderBy, defaultOrderByAsc, footerRenderer, headerRenderer, itemRenderer, idField = 'id', loadBatchSize, loadData, mRef, onItemsRendered, onSelectChange, rowHeight = 53, threshold = 6, width, onInitLoad, onUpdateRows, ...rest } = props;
|
|
11
11
|
// Rows
|
|
12
12
|
const [rows, updateRows] = React.useState([]);
|
|
13
|
-
const setRows = (rows) => {
|
|
13
|
+
const setRows = (rows, reset = false) => {
|
|
14
14
|
state.loadedItems = rows.length;
|
|
15
15
|
updateRows(rows);
|
|
16
|
-
if (onUpdateRows)
|
|
16
|
+
if (!reset && onUpdateRows)
|
|
17
17
|
onUpdateRows(rows, state);
|
|
18
18
|
};
|
|
19
19
|
// Refs
|
|
@@ -131,7 +131,7 @@ export const ScrollerGrid = (props) => {
|
|
|
131
131
|
Object.assign(state, resetState);
|
|
132
132
|
// Reset items
|
|
133
133
|
if (state.isMounted !== false)
|
|
134
|
-
setRows(items);
|
|
134
|
+
setRows(items, true);
|
|
135
135
|
};
|
|
136
136
|
const instance = {
|
|
137
137
|
scrollTo(params) {
|
|
@@ -28,10 +28,10 @@ export const ScrollerList = (props) => {
|
|
|
28
28
|
const refs = useCombinedRefs(oRef, outerRef);
|
|
29
29
|
// Rows
|
|
30
30
|
const [rows, updateRows] = React.useState([]);
|
|
31
|
-
const setRows = (rows) => {
|
|
31
|
+
const setRows = (rows, reset = false) => {
|
|
32
32
|
state.loadedItems = rows.length;
|
|
33
33
|
updateRows(rows);
|
|
34
|
-
if (onUpdateRows)
|
|
34
|
+
if (!reset && onUpdateRows)
|
|
35
35
|
onUpdateRows(rows, state);
|
|
36
36
|
};
|
|
37
37
|
// States
|
|
@@ -124,7 +124,7 @@ export const ScrollerList = (props) => {
|
|
|
124
124
|
Object.assign(state, resetState);
|
|
125
125
|
// Reset
|
|
126
126
|
if (state.isMounted !== false)
|
|
127
|
-
setRows(items);
|
|
127
|
+
setRows(items, true);
|
|
128
128
|
};
|
|
129
129
|
React.useImperativeHandle(mRef, () => {
|
|
130
130
|
const refMethods = listRef.current;
|
package/package.json
CHANGED
|
@@ -188,11 +188,11 @@ export const ScrollerGrid = <
|
|
|
188
188
|
|
|
189
189
|
// Rows
|
|
190
190
|
const [rows, updateRows] = React.useState<T[]>([]);
|
|
191
|
-
const setRows = (rows: T[]) => {
|
|
191
|
+
const setRows = (rows: T[], reset: boolean = false) => {
|
|
192
192
|
state.loadedItems = rows.length;
|
|
193
193
|
updateRows(rows);
|
|
194
194
|
|
|
195
|
-
if (onUpdateRows) onUpdateRows(rows, state);
|
|
195
|
+
if (!reset && onUpdateRows) onUpdateRows(rows, state);
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
// Refs
|
|
@@ -337,7 +337,7 @@ export const ScrollerGrid = <
|
|
|
337
337
|
Object.assign(state, resetState);
|
|
338
338
|
|
|
339
339
|
// Reset items
|
|
340
|
-
if (state.isMounted !== false) setRows(items);
|
|
340
|
+
if (state.isMounted !== false) setRows(items, true);
|
|
341
341
|
};
|
|
342
342
|
|
|
343
343
|
const instance: ScrollerGridForwardRef<T> = {
|
|
@@ -150,11 +150,11 @@ export const ScrollerList = <
|
|
|
150
150
|
|
|
151
151
|
// Rows
|
|
152
152
|
const [rows, updateRows] = React.useState<T[]>([]);
|
|
153
|
-
const setRows = (rows: T[]) => {
|
|
153
|
+
const setRows = (rows: T[], reset: boolean = false) => {
|
|
154
154
|
state.loadedItems = rows.length;
|
|
155
155
|
updateRows(rows);
|
|
156
156
|
|
|
157
|
-
if (onUpdateRows) onUpdateRows(rows, state);
|
|
157
|
+
if (!reset && onUpdateRows) onUpdateRows(rows, state);
|
|
158
158
|
};
|
|
159
159
|
|
|
160
160
|
// States
|
|
@@ -262,7 +262,7 @@ export const ScrollerList = <
|
|
|
262
262
|
Object.assign(state, resetState);
|
|
263
263
|
|
|
264
264
|
// Reset
|
|
265
|
-
if (state.isMounted !== false) setRows(items);
|
|
265
|
+
if (state.isMounted !== false) setRows(items, true);
|
|
266
266
|
};
|
|
267
267
|
|
|
268
268
|
React.useImperativeHandle(
|