@bluemarble/bm-components 0.0.73 → 0.0.75
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;
|
|
@@ -15158,7 +15162,7 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
|
|
|
15158
15162
|
if (sortedBy) {
|
|
15159
15163
|
return data.sort((a, b) => {
|
|
15160
15164
|
const compare = b[sortedBy] > a[sortedBy];
|
|
15161
|
-
if (sortedDirection === '
|
|
15165
|
+
if (sortedDirection === 'desc')
|
|
15162
15166
|
return compare ? 1 : -1;
|
|
15163
15167
|
return compare ? -1 : 1;
|
|
15164
15168
|
});
|
|
@@ -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
|
|