@bluemarble/bm-components 1.11.3 → 1.11.5

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
@@ -237,7 +237,6 @@ interface UseGridProps$1<T> {
237
237
  }
238
238
  declare function useGrid<T extends Record<string, any>>({ columns, filters, search, rowsPerPageOptions, defaultData: externalDefaultData, defaultCurrentPage, defaultSortedBy }: UseGridProps$1<T>): {
239
239
  data: T[];
240
- updatedTimes: number;
241
240
  set: (data: T[]) => void;
242
241
  onSortBy: (prop: string) => void;
243
242
  sortedBy: SortedByProps$1[];
package/dist/index.d.ts CHANGED
@@ -237,7 +237,6 @@ interface UseGridProps$1<T> {
237
237
  }
238
238
  declare function useGrid<T extends Record<string, any>>({ columns, filters, search, rowsPerPageOptions, defaultData: externalDefaultData, defaultCurrentPage, defaultSortedBy }: UseGridProps$1<T>): {
239
239
  data: T[];
240
- updatedTimes: number;
241
240
  set: (data: T[]) => void;
242
241
  onSortBy: (prop: string) => void;
243
242
  sortedBy: SortedByProps$1[];
package/dist/index.js CHANGED
@@ -4775,7 +4775,7 @@ function createFilter(filters) {
4775
4775
  var _sortby = require('sort-by'); var _sortby2 = _interopRequireDefault(_sortby);
4776
4776
  function useGrid({
4777
4777
  columns,
4778
- filters = [],
4778
+ filters,
4779
4779
  search,
4780
4780
  rowsPerPageOptions = [30, 60, 100],
4781
4781
  defaultData: externalDefaultData,
@@ -4788,7 +4788,6 @@ function useGrid({
4788
4788
  );
4789
4789
  const [currentPage, setCurrentPage] = _react.useState.call(void 0, defaultCurrentPage || 0);
4790
4790
  const [rowsPerPage, setRowsPerPage] = _react.useState.call(void 0, rowsPerPageOptions[0]);
4791
- const [updatedTimes, setUpdatedTimes] = _react.useState.call(void 0, 0);
4792
4791
  const toggleSortedDirection = _react.useCallback.call(void 0,
4793
4792
  (direction) => {
4794
4793
  if (direction === "asc")
@@ -4828,7 +4827,6 @@ function useGrid({
4828
4827
  [toggleSortedDirection, sortedBy]
4829
4828
  );
4830
4829
  const set = _react.useCallback.call(void 0, (data) => {
4831
- setUpdatedTimes((prev) => prev + 1);
4832
4830
  setDefaultData(data);
4833
4831
  }, []);
4834
4832
  const sortData = _react.useCallback.call(void 0,
@@ -4870,9 +4868,11 @@ function useGrid({
4870
4868
  const searchBy = createSearch(search);
4871
4869
  newData = newData.filter(searchBy);
4872
4870
  }
4871
+ if (!filters)
4872
+ return newData;
4873
4873
  const newFilter = createFilter(filters);
4874
4874
  return newData.filter(newFilter.apply);
4875
- }, [defaultData, filters, search]);
4875
+ }, [defaultData, search, filters]);
4876
4876
  const displayData = _react.useMemo.call(void 0, () => {
4877
4877
  const sortedData = sortData(filteredData);
4878
4878
  const startPage = currentPage * rowsPerPage;
@@ -4886,7 +4886,6 @@ function useGrid({
4886
4886
  }, [externalDefaultData]);
4887
4887
  return {
4888
4888
  data: displayData,
4889
- updatedTimes,
4890
4889
  set,
4891
4890
  onSortBy,
4892
4891
  sortedBy,