@bluemarble/bm-components 0.0.75 → 0.0.78
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
|
@@ -15032,21 +15032,31 @@ const GridPagination = ({ currentPage, totalNumberOfPages, onPageChange, rowsPer
|
|
|
15032
15032
|
React__default.createElement(MdArrowForwardIos, { size: 8 * 2 })))));
|
|
15033
15033
|
};
|
|
15034
15034
|
|
|
15035
|
-
function BaseGrid({ columns, children, fixedColumns, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense = true, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions }) {
|
|
15035
|
+
function BaseGrid({ columns, children, fixedColumns, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense = true, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, hideFooter, isLoading }) {
|
|
15036
15036
|
return (React__default.createElement(Paper, Object.assign({}, paperProps, { sx: Object.assign({ 'tr td': {
|
|
15037
|
-
py: dense ? 0.23 : 0.7
|
|
15038
|
-
|
|
15037
|
+
py: dense ? 0.23 : 0.7
|
|
15038
|
+
}, 'tr td:not(:last-child), tr th:not(:last-child)': {
|
|
15039
|
+
borderRight: bordered ? '1px solid' : '',
|
|
15039
15040
|
borderColor: 'divider'
|
|
15040
15041
|
}, 'tr:nth-of-type(even)': {
|
|
15041
15042
|
transition: 'background-color ease 200ms',
|
|
15042
15043
|
bgcolor: striped ? 'divider' : 'initial'
|
|
15043
|
-
},
|
|
15044
|
+
}, 'tbody tr:last-child td': {
|
|
15045
|
+
borderBottomWidth: hideFooter ? 0 : 1
|
|
15046
|
+
} }, paperProps === null || paperProps === void 0 ? void 0 : paperProps.sx) }),
|
|
15044
15047
|
React__default.createElement(Table, Object.assign({ size: "small", stickyHeader: true }, tableProps, { sx: Object.assign({}, tableProps === null || tableProps === void 0 ? void 0 : tableProps.sx) }),
|
|
15045
15048
|
React__default.createElement(TableHead, Object.assign({}, tableHeadProps),
|
|
15046
15049
|
React__default.createElement(TableRow, null, columns.map((column) => (React__default.createElement(TableCell, { key: column.name, padding: dense ? 'none' : 'normal', sx: Object.assign({ pl: 2 }, column === null || column === void 0 ? void 0 : column.sx) },
|
|
15047
|
-
React__default.createElement(TableSortLabel, { active: sortedBy === column.name, direction: sortedDirection, onClick: () => onSortBy(column.name), disabled: column.canSort === false
|
|
15050
|
+
React__default.createElement(TableSortLabel, { active: sortedBy === column.name, direction: sortedDirection, onClick: () => onSortBy(column.name), disabled: column.canSort === false }, column.label))))),
|
|
15051
|
+
isLoading && (React__default.createElement(TableRow, null,
|
|
15052
|
+
React__default.createElement(TableCell, { colSpan: columns.length, sx: { p: 0, border: 'none' } },
|
|
15053
|
+
React__default.createElement(LinearProgress, null))))),
|
|
15048
15054
|
React__default.createElement(TableBody, Object.assign({}, tableBodyProps), children)),
|
|
15049
|
-
React__default.createElement(GridPagination, { rowsPerPageOptions: rowsPerPageOptions, currentPage: currentPage, totalNumberOfPages: totalNumberOfPages, onPageChange: onPageChange, setRowsPerPage: setRowsPerPage, rowsPerPage: rowsPerPage, dense: dense })));
|
|
15055
|
+
!hideFooter && (React__default.createElement(GridPagination, { rowsPerPageOptions: rowsPerPageOptions, currentPage: currentPage, totalNumberOfPages: totalNumberOfPages, onPageChange: onPageChange, setRowsPerPage: setRowsPerPage, rowsPerPage: rowsPerPage, dense: dense }))));
|
|
15056
|
+
}
|
|
15057
|
+
|
|
15058
|
+
function getObjectValue(obj) {
|
|
15059
|
+
return (prop) => prop.split('.').reduce((o, k) => o[k], obj);
|
|
15050
15060
|
}
|
|
15051
15061
|
|
|
15052
15062
|
function useFilter() {
|
|
@@ -15075,9 +15085,6 @@ function useFilter() {
|
|
|
15075
15085
|
clearAllFilters
|
|
15076
15086
|
};
|
|
15077
15087
|
}
|
|
15078
|
-
function getObjectValue(obj) {
|
|
15079
|
-
return (prop) => prop.split('.').reduce((o, k) => o[k], obj);
|
|
15080
|
-
}
|
|
15081
15088
|
function isDate(date) {
|
|
15082
15089
|
if (date instanceof Date)
|
|
15083
15090
|
return true;
|
|
@@ -15161,7 +15168,8 @@ function useGrid({ columns, filters = [], rowsPerPageOptions = [30, 60, 100] })
|
|
|
15161
15168
|
function sortData(data) {
|
|
15162
15169
|
if (sortedBy) {
|
|
15163
15170
|
return data.sort((a, b) => {
|
|
15164
|
-
const
|
|
15171
|
+
const rowValue = (row) => getObjectValue(row)(sortedBy);
|
|
15172
|
+
const compare = rowValue(b) > rowValue(a);
|
|
15165
15173
|
if (sortedDirection === 'desc')
|
|
15166
15174
|
return compare ? 1 : -1;
|
|
15167
15175
|
return compare ? -1 : 1;
|