@bluemarble/bm-components 0.0.72 → 0.0.74

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/esm/index.js CHANGED
@@ -15135,6 +15135,10 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
15135
15135
  if (sortedDirection === 'asc')
15136
15136
  setSortedDirection('desc');
15137
15137
  };
15138
+ function setSort(prop, direction) {
15139
+ setSortedBy(prop);
15140
+ setSortedDirection(direction);
15141
+ }
15138
15142
  const onSortBy = (prop) => {
15139
15143
  if (!prop)
15140
15144
  return;
@@ -15154,7 +15158,7 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
15154
15158
  const set = (data) => {
15155
15159
  setDefaultData(data);
15156
15160
  };
15157
- const sortData = (data) => {
15161
+ function sortData(data) {
15158
15162
  if (sortedBy) {
15159
15163
  return data.sort((a, b) => {
15160
15164
  const compare = b[sortedBy] > a[sortedBy];
@@ -15165,7 +15169,7 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
15165
15169
  }
15166
15170
  else
15167
15171
  return data;
15168
- };
15172
+ }
15169
15173
  const onPageChange = (pageNumber) => {
15170
15174
  if (pageNumber < 0)
15171
15175
  return;
@@ -15205,7 +15209,8 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
15205
15209
  onPageChange,
15206
15210
  setRowsPerPage: onChangeRowsPerPage,
15207
15211
  rowsPerPageOptions,
15208
- rowsPerPage
15212
+ rowsPerPage,
15213
+ setSort
15209
15214
  };
15210
15215
  }
15211
15216