react-better-html 1.1.104 → 1.1.106

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 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
@@ -6893,7 +6893,7 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
6893
6893
  ${(props) => props.withHover ? import_styled_components11.css`
6894
6894
  transition: ${props.theme.styles.transition};
6895
6895
 
6896
- &:not(.isHeader):hover {
6896
+ &:not(.isHeader):not(.isFooter):not(.withoutHover):hover {
6897
6897
  filter: brightness(${props.colorTheme === "light" ? "0.95" : "0.85"});
6898
6898
  }
6899
6899
  ` : ""}
@@ -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 pagesCount = pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1;
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(pagesCount, currentPage + halfRange);
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(pagesCount, startPage + maximumVisiblePages - 1);
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
- }, [pagesCount, currentPage]);
7237
+ }, [pageCountInternal, currentPage]);
7237
7238
  const onClickNextPage = (0, import_react23.useCallback)(() => {
7238
- setCurrentPage((oldValue) => oldValue >= pagesCount ? pagesCount : oldValue + 1);
7239
- }, [pagesCount]);
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, pagesCount, setCheckedItems]
7265
+ [currentPage, setCurrentPage, pageCountInternal, setCheckedItems]
7265
7266
  );
7266
- const mobileFooterBreakingPoint = mediumScreen.size700 && pagesCount > maximumVisiblePages / 1.4;
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,
@@ -7318,7 +7319,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7318
7319
  },
7319
7320
  column.type + column.label + index
7320
7321
  )) }) }),
7321
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7322
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7322
7323
  "tr",
7323
7324
  {
7324
7325
  className: onClickRow ? "isClickable" : void 0,
@@ -7326,7 +7327,7 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7326
7327
  children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
7327
7328
  },
7328
7329
  JSON.stringify(item) + rowIndex
7329
- )) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7330
+ )) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "withoutHover", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7330
7331
  pageSize !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7331
7332
  Div_default.column,
7332
7333
  {
@@ -7347,12 +7348,12 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
7347
7348
  children: [
7348
7349
  currentPage,
7349
7350
  " / ",
7350
- pagesCount
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
- pagesCount > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
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 === pagesCount,
7408
+ disabled: currentPage === pageCountInternal,
7408
7409
  onClick: onClickNextPage
7409
7410
  }
7410
7411
  ),
7411
- pagesCount > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7412
+ pageCountInternal > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7412
7413
  Button_default.icon,
7413
7414
  {
7414
7415
  icon: "doubleChevronRight",
7415
- disabled: currentPage === pagesCount,
7416
+ disabled: currentPage === pageCountInternal,
7416
7417
  onClickWithValue: setCurrentPage,
7417
- value: pagesCount
7418
+ value: pageCountInternal
7418
7419
  }
7419
7420
  )
7420
7421
  ] })