@farmzone/fz-react-ui 1.0.15 → 1.0.16
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.
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1431,7 +1431,8 @@ function getVisiblePageRange(currentPage, totalPages) {
|
|
|
1431
1431
|
return { start, end };
|
|
1432
1432
|
}
|
|
1433
1433
|
function Pagination(props) {
|
|
1434
|
-
const { page = 0, totalPages =
|
|
1434
|
+
const { page = 0, totalPages: rawTotalPages = 0, onPageChange } = props;
|
|
1435
|
+
const totalPages = Math.max(1, rawTotalPages);
|
|
1435
1436
|
const [displayPage, setDisplayPage] = React6.useState(page);
|
|
1436
1437
|
React6.useEffect(() => {
|
|
1437
1438
|
setDisplayPage(page);
|
|
@@ -1443,6 +1444,7 @@ function Pagination(props) {
|
|
|
1443
1444
|
},
|
|
1444
1445
|
[onPageChange]
|
|
1445
1446
|
);
|
|
1447
|
+
const isEmpty = rawTotalPages === 0;
|
|
1446
1448
|
const pageButtons = React6.useMemo(() => {
|
|
1447
1449
|
const { start, end } = getVisiblePageRange(displayPage, totalPages);
|
|
1448
1450
|
const buttons = [];
|
|
@@ -1454,9 +1456,10 @@ function Pagination(props) {
|
|
|
1454
1456
|
"button",
|
|
1455
1457
|
{
|
|
1456
1458
|
type: "button",
|
|
1459
|
+
disabled: isEmpty,
|
|
1457
1460
|
className: cn(
|
|
1458
|
-
"min-w-7 min-h-7 rounded-[4px] text-[14px] px-[5px] font-medium
|
|
1459
|
-
isActive ? "bg-[#2675e2] text-white font-bold" : "bg-white text-[#000000] font-normal hover:bg-gray-50"
|
|
1461
|
+
"min-w-7 min-h-7 rounded-[4px] text-[14px] px-[5px] font-medium",
|
|
1462
|
+
isEmpty ? "bg-[#2675e2] text-white font-bold cursor-default" : isActive ? "bg-[#2675e2] text-white font-bold cursor-pointer" : "bg-white text-[#000000] font-normal hover:bg-gray-50 cursor-pointer"
|
|
1460
1463
|
),
|
|
1461
1464
|
onClick: () => handlePageChange(pageIndex),
|
|
1462
1465
|
children: displayPageNumber
|
|
@@ -1466,7 +1469,7 @@ function Pagination(props) {
|
|
|
1466
1469
|
);
|
|
1467
1470
|
}
|
|
1468
1471
|
return buttons;
|
|
1469
|
-
}, [displayPage, totalPages, handlePageChange]);
|
|
1472
|
+
}, [displayPage, totalPages, handlePageChange, isEmpty]);
|
|
1470
1473
|
const isFirstDisabled = displayPage <= 0;
|
|
1471
1474
|
const isPreviousDisabled = displayPage <= 0;
|
|
1472
1475
|
const isNextDisabled = displayPage >= totalPages - 1;
|
|
@@ -1486,9 +1489,6 @@ function Pagination(props) {
|
|
|
1486
1489
|
children
|
|
1487
1490
|
}
|
|
1488
1491
|
);
|
|
1489
|
-
if (!totalPages || totalPages === 0) {
|
|
1490
|
-
return null;
|
|
1491
|
-
}
|
|
1492
1492
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row items-center gap-1.5", children: [
|
|
1493
1493
|
renderNavButton(
|
|
1494
1494
|
() => handlePageChange(0),
|
|
@@ -2828,7 +2828,7 @@ function DatePickerSingle(props) {
|
|
|
2828
2828
|
"div",
|
|
2829
2829
|
{
|
|
2830
2830
|
role: "button",
|
|
2831
|
-
tabIndex:
|
|
2831
|
+
tabIndex: -1,
|
|
2832
2832
|
"aria-hidden": disabled,
|
|
2833
2833
|
onClick: () => {
|
|
2834
2834
|
if (!disabled) toggleCalendar(inputValue);
|
|
@@ -5262,7 +5262,7 @@ function Table(props) {
|
|
|
5262
5262
|
] })
|
|
5263
5263
|
}
|
|
5264
5264
|
),
|
|
5265
|
-
!
|
|
5265
|
+
!showSkeleton && (paginationInfo || renderFooter?.renderLeft || renderFooter?.renderRight) && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: footerRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5266
5266
|
TableFooter,
|
|
5267
5267
|
{
|
|
5268
5268
|
paginationInfo,
|