react-better-html 1.1.104 → 1.1.105
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -702,6 +702,7 @@ type TableProps<DataItem> = {
|
|
|
702
702
|
/** @default "No data available" */
|
|
703
703
|
noDataItemsMessage?: string;
|
|
704
704
|
pageSize?: number;
|
|
705
|
+
pageCount?: number;
|
|
705
706
|
onClickRow?: (item: DataItem, index: number) => void;
|
|
706
707
|
onClickAllCheckboxes?: (checked: boolean) => void;
|
|
707
708
|
onChangePage?: (page: number) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -702,6 +702,7 @@ type TableProps<DataItem> = {
|
|
|
702
702
|
/** @default "No data available" */
|
|
703
703
|
noDataItemsMessage?: string;
|
|
704
704
|
pageSize?: number;
|
|
705
|
+
pageCount?: number;
|
|
705
706
|
onClickRow?: (item: DataItem, index: number) => void;
|
|
706
707
|
onClickAllCheckboxes?: (checked: boolean) => void;
|
|
707
708
|
onChangePage?: (page: number) => void;
|
package/dist/index.js
CHANGED
|
@@ -6949,6 +6949,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
6949
6949
|
withStickyHeader,
|
|
6950
6950
|
noDataItemsMessage = "No data available",
|
|
6951
6951
|
pageSize,
|
|
6952
|
+
pageCount,
|
|
6952
6953
|
onClickRow,
|
|
6953
6954
|
onClickAllCheckboxes,
|
|
6954
6955
|
onChangePage,
|
|
@@ -7218,14 +7219,14 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7218
7219
|
[]
|
|
7219
7220
|
);
|
|
7220
7221
|
}, [data, openedFilterColumn]);
|
|
7221
|
-
const
|
|
7222
|
+
const pageCountInternal = pageCount ?? (pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1);
|
|
7222
7223
|
const paginationItems = (0, import_react23.useMemo)(() => {
|
|
7223
7224
|
const halfRange = Math.floor(maximumVisiblePages / 2);
|
|
7224
7225
|
let startPage = Math.max(1, currentPage - halfRange);
|
|
7225
|
-
let endPage = Math.min(
|
|
7226
|
+
let endPage = Math.min(pageCountInternal, currentPage + halfRange);
|
|
7226
7227
|
if (endPage - startPage + 1 < maximumVisiblePages) {
|
|
7227
7228
|
startPage = Math.max(1, endPage - maximumVisiblePages + 1);
|
|
7228
|
-
endPage = Math.min(
|
|
7229
|
+
endPage = Math.min(pageCountInternal, startPage + maximumVisiblePages - 1);
|
|
7229
7230
|
}
|
|
7230
7231
|
return Array.from(
|
|
7231
7232
|
{
|
|
@@ -7233,10 +7234,10 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7233
7234
|
},
|
|
7234
7235
|
(_, index) => startPage + index
|
|
7235
7236
|
);
|
|
7236
|
-
}, [
|
|
7237
|
+
}, [pageCountInternal, currentPage]);
|
|
7237
7238
|
const onClickNextPage = (0, import_react23.useCallback)(() => {
|
|
7238
|
-
setCurrentPage((oldValue) => oldValue >=
|
|
7239
|
-
}, [
|
|
7239
|
+
setCurrentPage((oldValue) => oldValue >= pageCountInternal ? pageCountInternal : oldValue + 1);
|
|
7240
|
+
}, [pageCountInternal]);
|
|
7240
7241
|
const onClickPreviousPage = (0, import_react23.useCallback)(() => {
|
|
7241
7242
|
setCurrentPage((oldValue) => oldValue <= 1 ? 1 : oldValue - 1);
|
|
7242
7243
|
}, []);
|
|
@@ -7257,13 +7258,13 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7257
7258
|
return {
|
|
7258
7259
|
currentPage,
|
|
7259
7260
|
setCurrentPage,
|
|
7260
|
-
pagesCount,
|
|
7261
|
+
pagesCount: pageCountInternal,
|
|
7261
7262
|
setCheckedItems
|
|
7262
7263
|
};
|
|
7263
7264
|
},
|
|
7264
|
-
[currentPage, setCurrentPage,
|
|
7265
|
+
[currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
|
|
7265
7266
|
);
|
|
7266
|
-
const mobileFooterBreakingPoint = mediumScreen.size700 &&
|
|
7267
|
+
const mobileFooterBreakingPoint = mediumScreen.size700 && pageCountInternal > maximumVisiblePages / 1.4;
|
|
7267
7268
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
7268
7269
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7269
7270
|
Div_default,
|
|
@@ -7347,12 +7348,12 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7347
7348
|
children: [
|
|
7348
7349
|
currentPage,
|
|
7349
7350
|
" / ",
|
|
7350
|
-
|
|
7351
|
+
pageCountInternal
|
|
7351
7352
|
]
|
|
7352
7353
|
}
|
|
7353
7354
|
),
|
|
7354
7355
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
7355
|
-
|
|
7356
|
+
pageCountInternal > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7356
7357
|
Button_default.icon,
|
|
7357
7358
|
{
|
|
7358
7359
|
icon: "doubleChevronLeft",
|
|
@@ -7404,17 +7405,17 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
|
|
|
7404
7405
|
Button_default.icon,
|
|
7405
7406
|
{
|
|
7406
7407
|
icon: "chevronRight",
|
|
7407
|
-
disabled: currentPage ===
|
|
7408
|
+
disabled: currentPage === pageCountInternal,
|
|
7408
7409
|
onClick: onClickNextPage
|
|
7409
7410
|
}
|
|
7410
7411
|
),
|
|
7411
|
-
|
|
7412
|
+
pageCountInternal > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7412
7413
|
Button_default.icon,
|
|
7413
7414
|
{
|
|
7414
7415
|
icon: "doubleChevronRight",
|
|
7415
|
-
disabled: currentPage ===
|
|
7416
|
+
disabled: currentPage === pageCountInternal,
|
|
7416
7417
|
onClickWithValue: setCurrentPage,
|
|
7417
|
-
value:
|
|
7418
|
+
value: pageCountInternal
|
|
7418
7419
|
}
|
|
7419
7420
|
)
|
|
7420
7421
|
] })
|