react-better-html 1.1.212 → 1.1.214

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.mjs CHANGED
@@ -8092,6 +8092,7 @@ var TableComponent = forwardRef15(function Table({
8092
8092
  isInsideTableExpandRow,
8093
8093
  containsOverflowComponents,
8094
8094
  wrapperComponentRef,
8095
+ defaultFilterData,
8095
8096
  memoizeFilters,
8096
8097
  memoizeFiltersLifespan = 72e5,
8097
8098
  getRowStyle,
@@ -8113,12 +8114,12 @@ var TableComponent = forwardRef15(function Table({
8113
8114
  const [expandedRows, setExpandedRows] = useState10([]);
8114
8115
  const [currentPage, setCurrentPage] = useState10(1);
8115
8116
  const [filterData, setFilterData] = useState10(() => {
8116
- if (!memoizeFilters || !name) return {};
8117
+ if (!memoizeFilters || !name) return defaultFilterData ?? {};
8117
8118
  const localStorageData = JSON.parse(localStorage.getItem(`react-better-html-table-filters-${name}`) || "{}");
8118
8119
  const timestamp = localStorageData.timestamp;
8119
- const data2 = localStorageData.data ?? {};
8120
+ const data2 = localStorageData.data ?? defaultFilterData ?? {};
8120
8121
  const timeDiff = Date.now() - timestamp;
8121
- if (timeDiff > memoizeFiltersLifespan) return {};
8122
+ if (timeDiff > memoizeFiltersLifespan) return defaultFilterData ?? {};
8122
8123
  return data2;
8123
8124
  });
8124
8125
  const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = useState10();
@@ -8532,28 +8533,31 @@ var TableComponent = forwardRef15(function Table({
8532
8533
  },
8533
8534
  column.type + column.label + index
8534
8535
  )) }) }),
8535
- /* @__PURE__ */ jsx23("tbody", { children: isLoading ? /* @__PURE__ */ jsx23("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx23("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ jsx23(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ jsxs19(Fragment6, { children: [
8536
- /* @__PURE__ */ jsx23(
8537
- "tr",
8538
- {
8539
- className: isInsideTableExpandRow && onClickRow === void 0 && expandColumn === void 0 ? "withoutHover" : void 0,
8540
- style: getRowStyle?.(item, rowIndex),
8541
- onClick: () => onClickRowElement(item, rowIndex),
8542
- children: readyColumns.map((column, colIndex) => /* @__PURE__ */ jsx23(
8543
- TdStyledComponent,
8544
- {
8545
- textAlign: column.align,
8546
- onClick: (event) => {
8547
- if (column.clickStopPropagation) event.stopPropagation();
8536
+ /* @__PURE__ */ jsx23("tbody", { children: isLoading ? /* @__PURE__ */ jsx23("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx23("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ jsx23(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => {
8537
+ const realRowIndex = rowIndex + (pageSize ? (currentPage - 1) * pageSize : 0);
8538
+ return /* @__PURE__ */ jsxs19(Fragment6, { children: [
8539
+ /* @__PURE__ */ jsx23(
8540
+ "tr",
8541
+ {
8542
+ className: isInsideTableExpandRow && onClickRow === void 0 && expandColumn === void 0 ? "withoutHover" : void 0,
8543
+ style: getRowStyle?.(item, realRowIndex),
8544
+ onClick: () => onClickRowElement(item, realRowIndex),
8545
+ children: readyColumns.map((column, colIndex) => /* @__PURE__ */ jsx23(
8546
+ TdStyledComponent,
8547
+ {
8548
+ textAlign: column.align,
8549
+ onClick: (event) => {
8550
+ if (column.clickStopPropagation) event.stopPropagation();
8551
+ },
8552
+ children: renderCellContent(column, item, realRowIndex)
8548
8553
  },
8549
- children: renderCellContent(column, item, rowIndex)
8550
- },
8551
- column.type + column.label + colIndex
8552
- ))
8553
- }
8554
- ),
8555
- expandedRows[rowIndex] && /* @__PURE__ */ jsx23("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ jsx23("td", { colSpan: readyColumns.length, children: renderExpandedRow(item, rowIndex) }) })
8556
- ] }, JSON.stringify(item) + rowIndex)) : /* @__PURE__ */ jsx23("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx23("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ jsx23(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
8554
+ column.type + column.label + colIndex
8555
+ ))
8556
+ }
8557
+ ),
8558
+ expandedRows[realRowIndex] && /* @__PURE__ */ jsx23("tr", { className: "withoutHover isExpandRow", children: /* @__PURE__ */ jsx23("td", { colSpan: readyColumns.length, children: renderExpandedRow(item, realRowIndex) }) })
8559
+ ] }, JSON.stringify(item) + realRowIndex);
8560
+ }) : /* @__PURE__ */ jsx23("tr", { className: "withoutHover", children: /* @__PURE__ */ jsx23("td", { className: "noData", colSpan: readyColumns.length, children: /* @__PURE__ */ jsx23(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
8557
8561
  withFooter && /* @__PURE__ */ jsx23("tfoot", { children: /* @__PURE__ */ jsx23("tr", { className: "isFooter", children: /* @__PURE__ */ jsx23("td", { colSpan: readyColumns.length, children: /* @__PURE__ */ jsxs19(
8558
8562
  Div_default.column,
8559
8563
  {