@smallwebco/tinypivot-react 1.0.11 → 1.0.13

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 CHANGED
@@ -146,7 +146,6 @@ function useExcelGrid(options) {
146
146
  const column = table.getColumn(columnId);
147
147
  if (column) {
148
148
  column.setFilterValue(values.length === 0 ? void 0 : values);
149
- setColumnFilters(table.getState().columnFilters);
150
149
  }
151
150
  },
152
151
  [table]
@@ -1844,7 +1843,7 @@ function DataGrid({
1844
1843
  const filteredDataForPivot = (0, import_react8.useMemo)(() => {
1845
1844
  const filteredRows = table.getFilteredRowModel().rows;
1846
1845
  return filteredRows.map((row) => row.original);
1847
- }, [table]);
1846
+ }, [table, columnFilters]);
1848
1847
  const {
1849
1848
  rowFields: pivotRowFields,
1850
1849
  columnFields: pivotColumnFields,
@@ -1876,7 +1875,7 @@ function DataGrid({
1876
1875
  values: f.values || []
1877
1876
  }));
1878
1877
  }, [activeFilters]);
1879
- const rows = (0, import_react8.useMemo)(() => table.getRowModel().rows, [table]);
1878
+ const rows = (0, import_react8.useMemo)(() => table.getFilteredRowModel().rows, [table, columnFilters]);
1880
1879
  const searchFilteredData = (0, import_react8.useMemo)(() => {
1881
1880
  if (!globalSearchTerm.trim() || !enableSearch) {
1882
1881
  return rows;
@@ -1904,6 +1903,9 @@ function DataGrid({
1904
1903
  const end = start + pageSize;
1905
1904
  return searchFilteredData.slice(start, end);
1906
1905
  }, [enablePagination, searchFilteredData, currentPage, pageSize]);
1906
+ (0, import_react8.useEffect)(() => {
1907
+ setCurrentPage(1);
1908
+ }, [columnFilters, globalSearchTerm]);
1907
1909
  const selectionBounds = (0, import_react8.useMemo)(() => {
1908
1910
  if (!selectionStart || !selectionEnd) return null;
1909
1911
  return {