sag_components 1.0.1029 → 1.0.1030
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.
|
@@ -42,33 +42,28 @@ const ReportTable = props => {
|
|
|
42
42
|
width,
|
|
43
43
|
height,
|
|
44
44
|
sortKey,
|
|
45
|
-
className
|
|
45
|
+
className,
|
|
46
|
+
limit,
|
|
47
|
+
page,
|
|
48
|
+
totalPages,
|
|
49
|
+
totalTableResults,
|
|
50
|
+
onPageChange,
|
|
51
|
+
isLoading
|
|
46
52
|
} = props;
|
|
47
53
|
const [FormattedTableData, setFormattedTableData] = (0, _react.useState)(tableData);
|
|
48
54
|
const [AllRowsChecked, setAllRowsChecked] = (0, _react.useState)(false);
|
|
49
55
|
const [activeSortColumn, setActiveSortColumn] = (0, _react.useState)();
|
|
50
|
-
const [currentPage, setCurrentPage] = (0, _react.useState)(
|
|
51
|
-
const rowsPerPage = 10;
|
|
56
|
+
const [currentPage, setCurrentPage] = (0, _react.useState)(page);
|
|
52
57
|
const getPaginatedRows = () => {
|
|
53
|
-
|
|
54
|
-
const endIndex = startIndex + rowsPerPage;
|
|
55
|
-
return FormattedTableData.rowsValues.slice(startIndex, endIndex);
|
|
58
|
+
return FormattedTableData.rowsValues;
|
|
56
59
|
};
|
|
57
|
-
const totalPages = Math.ceil(FormattedTableData.rowsValues.length / rowsPerPage);
|
|
58
|
-
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
59
60
|
const handlePageChange = newPage => {
|
|
60
|
-
|
|
61
|
-
setIsLoading(true);
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
setCurrentPage(newPage);
|
|
64
|
-
setIsLoading(false);
|
|
65
|
-
}, 500);
|
|
66
|
-
}
|
|
61
|
+
onPageChange(newPage);
|
|
67
62
|
};
|
|
68
63
|
const getRecordRangeDisplay = () => {
|
|
69
|
-
const startRecord = (
|
|
70
|
-
const endRecord =
|
|
71
|
-
const totalRecords =
|
|
64
|
+
const startRecord = (page - 1) * limit + 1;
|
|
65
|
+
const endRecord = page * limit;
|
|
66
|
+
const totalRecords = totalTableResults;
|
|
72
67
|
return `Showing ${startRecord}-${endRecord} of ${totalRecords}`;
|
|
73
68
|
};
|
|
74
69
|
(0, _react.useEffect)(() => {
|
|
@@ -297,7 +292,6 @@ const ReportTable = props => {
|
|
|
297
292
|
disabled: currentPage === 1
|
|
298
293
|
})), (() => {
|
|
299
294
|
const pages = [];
|
|
300
|
-
const maxVisiblePages = 7;
|
|
301
295
|
const range = 2;
|
|
302
296
|
pages.push( /*#__PURE__*/_react.default.createElement("span", {
|
|
303
297
|
key: 1,
|
|
@@ -417,5 +411,10 @@ ReportTable.defaultProps = {
|
|
|
417
411
|
onSelectRowClick: () => {},
|
|
418
412
|
onCheckRowClick: () => {},
|
|
419
413
|
onAllRowsCheckBoxClick: () => {},
|
|
420
|
-
useCheckBoxes: false
|
|
414
|
+
useCheckBoxes: false,
|
|
415
|
+
limit: 10,
|
|
416
|
+
page: 1,
|
|
417
|
+
totalPages: 25,
|
|
418
|
+
totalTableResults: 250,
|
|
419
|
+
isLoading: false
|
|
421
420
|
};
|