argous 1.2.233 → 1.2.234

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.
@@ -266,9 +266,13 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
266
266
  react_1.useEffect(function () {
267
267
  if (method || field || externalCtrlPgn)
268
268
  return;
269
- if (lodash_1.isArray(lista) && lista.length > 0 && page === Math.ceil(method ? ctrlPgn.recordCount : lista.length / parseInt(rowsPerPage, 10)))
269
+ if (lodash_1.isArray(lista) && (lista.length > 0) && (page === Math.ceil((method) ? ctrlPgn.recordCount : (lista.length / parseInt(rowsPerPage, 10)))))
270
270
  dispatch({ type: 'decremmentPage' });
271
- }, [page, method, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, field, externalCtrlPgn]);
271
+ if (lodash_1.isArray(lista) && (lista.length > 0) && ((page + 1) > Math.ceil((method) ? ctrlPgn.recordCount : (lista.length / parseInt(rowsPerPage, 10))))) {
272
+ dispatch({ type: 'setPage', value: 0 });
273
+ setCtrlPgn(function (currentState) { return (__assign(__assign({}, currentState), { pgAtl: 1 })); });
274
+ }
275
+ }, [page, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, method, field, externalCtrlPgn, dispatch]);
272
276
  react_1.useEffect(function () { return dispatch({ type: 'setSelected', value: [] }); }, [lista]);
273
277
  react_1.useEffect(function () {
274
278
  if (onSelect)
@@ -275,8 +275,12 @@ const ArgousComplexTable = forwardRef(({
275
275
 
276
276
  useEffect(() => {
277
277
  if (method || field || externalCtrlPgn) return;
278
- if (isArray(lista) && lista.length > 0 && page === Math.ceil(method ? ctrlPgn.recordCount : lista.length / parseInt(rowsPerPage, 10))) dispatch({ type: 'decremmentPage' });
279
- }, [page, method, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, field, externalCtrlPgn]);
278
+ if (isArray(lista) && (lista.length > 0) && (page === Math.ceil((method) ? ctrlPgn.recordCount : (lista.length / parseInt(rowsPerPage, 10))))) dispatch({ type: 'decremmentPage' });
279
+ if (isArray(lista) && (lista.length > 0) && ((page + 1) > Math.ceil((method) ? ctrlPgn.recordCount : (lista.length / parseInt(rowsPerPage, 10))))) {
280
+ dispatch({ type: 'setPage', value: 0 });
281
+ setCtrlPgn((currentState) => ({ ...currentState, pgAtl: 1 }));
282
+ }
283
+ }, [page, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, method, field, externalCtrlPgn, dispatch]);
280
284
 
281
285
  useEffect(() => dispatch({ type: 'setSelected', value: [] }), [lista]);
282
286
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.233",
3
+ "version": "1.2.234",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",