ar-design 0.3.83 → 0.3.84
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.
|
@@ -161,8 +161,8 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
161
161
|
...prev,
|
|
162
162
|
[name]: { value: value, operator: operator },
|
|
163
163
|
}));
|
|
164
|
-
if (pagination
|
|
165
|
-
pagination.onChange(1);
|
|
164
|
+
if (pagination)
|
|
165
|
+
pagination.onChange?.(1, selectedPerPage);
|
|
166
166
|
}, 750);
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
@@ -503,8 +503,8 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
503
503
|
setSearchedText((prev) => ({ ...prev, ...checkboxSelectedParams }));
|
|
504
504
|
}
|
|
505
505
|
setCurrentPage(1);
|
|
506
|
-
if (pagination
|
|
507
|
-
pagination.onChange(1);
|
|
506
|
+
if (pagination)
|
|
507
|
+
pagination.onChange?.(1, selectedPerPage);
|
|
508
508
|
}, [checkboxSelectedParams]);
|
|
509
509
|
useEffect(() => {
|
|
510
510
|
if (typeof selections === "function" && Array.isArray(selectionItems)) {
|
|
@@ -514,7 +514,7 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
514
514
|
const allChecked = _checkboxItems.current.every((item) => item?.checked === true);
|
|
515
515
|
setSelectAll(allChecked);
|
|
516
516
|
}
|
|
517
|
-
}, [selectionItems, currentPage]);
|
|
517
|
+
}, [selectionItems, currentPage, selectedPerPage]);
|
|
518
518
|
useEffect(() => {
|
|
519
519
|
// Filter Content alanı re-render işlemi.
|
|
520
520
|
if (filterCurrentColumn && filterCurrentDataType) {
|
|
@@ -736,9 +736,10 @@ const Table = forwardRef(({ children, trackBy, title, description, data, columns
|
|
|
736
736
|
"of ",
|
|
737
737
|
selectedPerPage ?? getData.length,
|
|
738
738
|
" agreement")),
|
|
739
|
-
React.createElement(Pagination, { totalRecords: config.isServerSide ? pagination.totalRecords : totalRecords ?? 0, currentPage: currentPage, perPage: selectedPerPage,
|
|
739
|
+
React.createElement(Pagination, { totalRecords: config.isServerSide ? pagination.totalRecords : totalRecords ?? 0, currentPage: currentPage, perPage: selectedPerPage, onChange: (currentPage, perPage) => {
|
|
740
740
|
setCurrentPage(currentPage);
|
|
741
|
-
|
|
741
|
+
setSelectedPerPage(perPage);
|
|
742
|
+
pagination.onChange?.(currentPage, perPage);
|
|
742
743
|
setTimeout(() => handleScroll(), 0);
|
|
743
744
|
} })))));
|
|
744
745
|
});
|
|
@@ -11,7 +11,7 @@ const perPageOptions = [
|
|
|
11
11
|
{ value: 75, text: "75" },
|
|
12
12
|
{ value: 100, text: "100" },
|
|
13
13
|
];
|
|
14
|
-
const Pagination = ({ currentPage, totalRecords, perPage,
|
|
14
|
+
const Pagination = ({ currentPage, totalRecords, perPage, onChange }) => {
|
|
15
15
|
// context
|
|
16
16
|
const { config } = useContext(ConfigContext);
|
|
17
17
|
// states
|
|
@@ -19,7 +19,7 @@ const Pagination = ({ currentPage, totalRecords, perPage, onPerPageChange, onCha
|
|
|
19
19
|
const [totalPageCount, setTotalPageCount] = useState(0);
|
|
20
20
|
const [selectedPerPage, setSelectedPerPage] = useState(perPageOptions.find((x) => x.value === 10));
|
|
21
21
|
// methods
|
|
22
|
-
const handlePageChange = (page) => onChange(page);
|
|
22
|
+
const handlePageChange = (page, perPage) => onChange(page, perPage);
|
|
23
23
|
// useEffects
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (totalRecords === 0)
|
|
@@ -34,39 +34,39 @@ const Pagination = ({ currentPage, totalRecords, perPage, onPerPageChange, onCha
|
|
|
34
34
|
const endPage = Math.min(_totalPageCount, activePage + 1);
|
|
35
35
|
// Sayfalama mantığı...
|
|
36
36
|
for (let i = startPage; i <= endPage; i++) {
|
|
37
|
-
liItems.push(React.createElement("li", { key: i, className: i === activePage ? "selection-page" : "", onClick: () => handlePageChange(i) }, i));
|
|
37
|
+
liItems.push(React.createElement("li", { key: i, className: i === activePage ? "selection-page" : "", onClick: () => handlePageChange(i, selectedPerPage?.value) }, i));
|
|
38
38
|
}
|
|
39
39
|
setPages(liItems);
|
|
40
40
|
}, [totalRecords, currentPage, perPage, config.perPage]);
|
|
41
41
|
return (React.createElement("div", { className: "ar-pagination" },
|
|
42
42
|
React.createElement(Select, { value: selectedPerPage, options: [...perPageOptions, { value: totalRecords, text: "Tümü" }], onChange: (option) => {
|
|
43
43
|
setSelectedPerPage(option);
|
|
44
|
-
|
|
44
|
+
handlePageChange(1, option?.value);
|
|
45
45
|
} }),
|
|
46
46
|
React.createElement("ul", null,
|
|
47
47
|
React.createElement("li", { className: currentPage === 1 ? "passive" : "", onClick: () => {
|
|
48
48
|
if (currentPage === 1)
|
|
49
49
|
return;
|
|
50
|
-
handlePageChange(1);
|
|
50
|
+
handlePageChange(1, selectedPerPage?.value);
|
|
51
51
|
} },
|
|
52
52
|
React.createElement("span", null, "«")),
|
|
53
53
|
React.createElement("li", { className: currentPage === 1 ? "passive" : "", onClick: () => {
|
|
54
54
|
if (currentPage === 1)
|
|
55
55
|
return;
|
|
56
|
-
handlePageChange(currentPage - 1);
|
|
56
|
+
handlePageChange(currentPage - 1, selectedPerPage?.value);
|
|
57
57
|
} },
|
|
58
58
|
React.createElement("span", null, "‹")),
|
|
59
59
|
pages,
|
|
60
60
|
React.createElement("li", { className: totalPageCount === currentPage ? "passive" : "", onClick: () => {
|
|
61
61
|
if (totalPageCount === currentPage)
|
|
62
62
|
return;
|
|
63
|
-
handlePageChange(currentPage + 1);
|
|
63
|
+
handlePageChange(currentPage + 1, selectedPerPage?.value);
|
|
64
64
|
} },
|
|
65
65
|
React.createElement("span", null, "›")),
|
|
66
66
|
React.createElement("li", { className: totalPageCount === currentPage ? "passive" : "", onClick: () => {
|
|
67
67
|
if (totalPageCount === currentPage)
|
|
68
68
|
return;
|
|
69
|
-
handlePageChange(totalPageCount);
|
|
69
|
+
handlePageChange(totalPageCount, selectedPerPage?.value);
|
|
70
70
|
} },
|
|
71
71
|
React.createElement("span", null, "»")))));
|
|
72
72
|
};
|