ordering-ui-admin-external 1.43.67 → 1.43.68

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.
@@ -74,26 +74,32 @@ var DriversList = exports.DriversList = function DriversList(props) {
74
74
  return validation;
75
75
  };
76
76
  var handleChangePage = function handleChangePage(page) {
77
- setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
78
- currentPage: page
79
- }));
77
+ setPagination(function (pagination) {
78
+ return _objectSpread(_objectSpread({}, pagination), {}, {
79
+ currentPage: page
80
+ });
81
+ });
80
82
  };
81
83
  var handleChangePageSize = function handleChangePageSize(pageSize) {
82
84
  var expectedPage = Math.ceil((((pagination === null || pagination === void 0 ? void 0 : pagination.currentPage) - 1) * (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) + 1) / pageSize);
83
- setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
84
- currentPage: expectedPage,
85
- pageSize: pageSize,
86
- totalPages: Math.ceil((drivers === null || drivers === void 0 ? void 0 : drivers.length) / pageSize)
87
- }));
85
+ setPagination(function (pagination) {
86
+ return _objectSpread(_objectSpread({}, pagination), {}, {
87
+ currentPage: expectedPage,
88
+ pageSize: pageSize,
89
+ totalPages: Math.ceil((drivers === null || drivers === void 0 ? void 0 : drivers.length) / pageSize)
90
+ });
91
+ });
88
92
  };
89
93
  (0, _react.useEffect)(function () {
90
94
  if (drivers !== null && drivers !== void 0 && drivers.length) {
91
- setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
92
- totalItems: drivers === null || drivers === void 0 ? void 0 : drivers.length,
93
- totalPages: Math.ceil((drivers === null || drivers === void 0 ? void 0 : drivers.length) / 10)
94
- }));
95
+ setPagination(function (pagination) {
96
+ return _objectSpread(_objectSpread({}, pagination), {}, {
97
+ totalItems: drivers === null || drivers === void 0 ? void 0 : drivers.length,
98
+ totalPages: Math.ceil((drivers === null || drivers === void 0 ? void 0 : drivers.length) / 10)
99
+ });
100
+ });
95
101
  }
96
- }, [drivers]);
102
+ }, [drivers === null || drivers === void 0 ? void 0 : drivers.length]);
97
103
  return /*#__PURE__*/_react.default.createElement(_styles.DriversListContainer, {
98
104
  showCompressedInfo: showCompressedInfo
99
105
  }, loading ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _toConsumableArray(Array(10).keys()).map(function (i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.43.67",
3
+ "version": "1.43.68",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.17.20",
84
84
  "moment": "^2.29.1",
85
85
  "moment-range": "^4.0.2",
86
- "ordering-components-admin-external": "1.43.43",
86
+ "ordering-components-admin-external": "1.43.44",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -56,31 +56,31 @@ export const DriversList = (props) => {
56
56
  }
57
57
 
58
58
  const handleChangePage = (page) => {
59
- setPagination({
59
+ setPagination((pagination) => ({
60
60
  ...pagination,
61
61
  currentPage: page
62
- })
62
+ }))
63
63
  }
64
64
 
65
65
  const handleChangePageSize = (pageSize) => {
66
66
  const expectedPage = Math.ceil(((pagination?.currentPage - 1) * pagination?.pageSize + 1) / pageSize)
67
- setPagination({
67
+ setPagination((pagination) => ({
68
68
  ...pagination,
69
69
  currentPage: expectedPage,
70
70
  pageSize,
71
71
  totalPages: Math.ceil(drivers?.length / pageSize)
72
- })
72
+ }))
73
73
  }
74
74
 
75
75
  useEffect(() => {
76
76
  if (drivers?.length) {
77
- setPagination({
77
+ setPagination((pagination) => ({
78
78
  ...pagination,
79
79
  totalItems: drivers?.length,
80
80
  totalPages: Math.ceil(drivers?.length / 10)
81
- })
81
+ }))
82
82
  }
83
- }, [drivers])
83
+ }, [drivers?.length])
84
84
 
85
85
  return (
86
86
  <DriversListContainer showCompressedInfo={showCompressedInfo}>