@bluemarble/bm-components 0.0.75 → 0.0.76
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
|
@@ -15049,6 +15049,10 @@ function BaseGrid({ columns, children, fixedColumns, paperProps, tableBodyProps,
|
|
|
15049
15049
|
React__default.createElement(GridPagination, { rowsPerPageOptions: rowsPerPageOptions, currentPage: currentPage, totalNumberOfPages: totalNumberOfPages, onPageChange: onPageChange, setRowsPerPage: setRowsPerPage, rowsPerPage: rowsPerPage, dense: dense })));
|
|
15050
15050
|
}
|
|
15051
15051
|
|
|
15052
|
+
function getObjectValue(obj) {
|
|
15053
|
+
return (prop) => prop.split('.').reduce((o, k) => o[k], obj);
|
|
15054
|
+
}
|
|
15055
|
+
|
|
15052
15056
|
function useFilter() {
|
|
15053
15057
|
const [selectedFilters, setSelectedFilters] = useState([]);
|
|
15054
15058
|
const filterBy = (newFilter) => {
|
|
@@ -15075,9 +15079,6 @@ function useFilter() {
|
|
|
15075
15079
|
clearAllFilters
|
|
15076
15080
|
};
|
|
15077
15081
|
}
|
|
15078
|
-
function getObjectValue(obj) {
|
|
15079
|
-
return (prop) => prop.split('.').reduce((o, k) => o[k], obj);
|
|
15080
|
-
}
|
|
15081
15082
|
function isDate(date) {
|
|
15082
15083
|
if (date instanceof Date)
|
|
15083
15084
|
return true;
|
|
@@ -15161,7 +15162,8 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
|
|
|
15161
15162
|
function sortData(data) {
|
|
15162
15163
|
if (sortedBy) {
|
|
15163
15164
|
return data.sort((a, b) => {
|
|
15164
|
-
const
|
|
15165
|
+
const rowValue = (row) => getObjectValue(row)(sortedBy);
|
|
15166
|
+
const compare = rowValue(b) > rowValue(a);
|
|
15165
15167
|
if (sortedDirection === 'desc')
|
|
15166
15168
|
return compare ? 1 : -1;
|
|
15167
15169
|
return compare ? -1 : 1;
|