@farmzone/fz-react-ui 1.0.15 → 1.0.17
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 +20 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +20 -13
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
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);
|
|
@@ -4740,7 +4740,13 @@ function Table(props) {
|
|
|
4740
4740
|
showHorizontalDivider = true,
|
|
4741
4741
|
showVerticalDivider = true
|
|
4742
4742
|
} = props;
|
|
4743
|
-
const {
|
|
4743
|
+
const {
|
|
4744
|
+
fixed = false,
|
|
4745
|
+
onSelectionChange,
|
|
4746
|
+
selectedKeys = [],
|
|
4747
|
+
disabledKeys = [],
|
|
4748
|
+
disabledTooltip
|
|
4749
|
+
} = checkboxInfo ?? {};
|
|
4744
4750
|
const scrollRef = React6.useRef(null);
|
|
4745
4751
|
const footerRef = React6.useRef(null);
|
|
4746
4752
|
const [tableHeight, setTableHeight] = React6.useState(500);
|
|
@@ -5129,7 +5135,7 @@ function Table(props) {
|
|
|
5129
5135
|
TableCellContent,
|
|
5130
5136
|
{
|
|
5131
5137
|
cellContent,
|
|
5132
|
-
tooltipText: String(record[col.key] ?? ""),
|
|
5138
|
+
tooltipText: col.tooltipText ? col.tooltipText(record[col.key], record, rowIdx) : String(record[col.key] ?? ""),
|
|
5133
5139
|
align: align ?? "",
|
|
5134
5140
|
tooltipConfig: col.key === "__checkbox__" ? false : tooltipConfig,
|
|
5135
5141
|
onCellClick: col.key !== "__checkbox__" && onRowClickRef.current ? () => onRowClickRef.current?.(record, rowIdx) : void 0
|
|
@@ -5262,7 +5268,7 @@ function Table(props) {
|
|
|
5262
5268
|
] })
|
|
5263
5269
|
}
|
|
5264
5270
|
),
|
|
5265
|
-
!
|
|
5271
|
+
!showSkeleton && (paginationInfo || renderFooter?.renderLeft || renderFooter?.renderRight) && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: footerRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5266
5272
|
TableFooter,
|
|
5267
5273
|
{
|
|
5268
5274
|
paginationInfo,
|
|
@@ -7781,8 +7787,9 @@ function PageFilter(props) {
|
|
|
7781
7787
|
const handleInputChange = (key) => (e) => {
|
|
7782
7788
|
onChange({ [key]: e.target.value });
|
|
7783
7789
|
};
|
|
7784
|
-
const handleSelectChange = (key) => (value) => {
|
|
7790
|
+
const handleSelectChange = (key, autoSubmit) => (value) => {
|
|
7785
7791
|
onChange({ [key]: value });
|
|
7792
|
+
if (autoSubmit) onSubmit();
|
|
7786
7793
|
};
|
|
7787
7794
|
const handleRadioChange = (key) => (value) => {
|
|
7788
7795
|
onChange({ [key]: value });
|
|
@@ -7825,7 +7832,7 @@ function PageFilter(props) {
|
|
|
7825
7832
|
Select2,
|
|
7826
7833
|
{
|
|
7827
7834
|
value: currentValue,
|
|
7828
|
-
onChange: handleSelectChange(optionKey),
|
|
7835
|
+
onChange: handleSelectChange(optionKey, option.autoSubmit),
|
|
7829
7836
|
options: option.options,
|
|
7830
7837
|
placeholder: option.placeholder || "\uC120\uD0DD",
|
|
7831
7838
|
canReset: option.canReset ?? true,
|