diff --git a/README.md b/README.md index a262ce28..8638a1a7 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ Please review our [roadmap](https://github.com/material-table-core/core/wiki/Roa +# Mui V6 is currently in progress + # Sponsoring We are now able to be sponsored via [Github Sponsors](https://github.com/sponsors/material-table-core?o=esb) or [Open collective](https://opencollective.com/material-table-core)! diff --git a/src/components/MTableAction/index.js b/src/components/MTableAction/index.js index b97dcda4..0a78f47d 100644 --- a/src/components/MTableAction/index.js +++ b/src/components/MTableAction/index.js @@ -80,7 +80,7 @@ function MTableAction({ if (action.tooltip) { // fix for issue #1049 // https://github.com/mbrn/material-table/issues/1049 - return disabled ? ( + return isDisabled ? ( {button} @@ -99,12 +99,13 @@ const defaultProps = { MTableAction.propTypes = { action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired, + columns: PropTypes.array, data: PropTypes.oneOfType([ PropTypes.object, PropTypes.arrayOf(PropTypes.object) ]), disabled: PropTypes.bool, - onColumnsChanged: PropTypes.func.isRequired, + onColumnsChanged: PropTypes.func, size: PropTypes.string }; diff --git a/src/components/MTableActions/index.js b/src/components/MTableActions/index.js index 08c7f30a..821c97bb 100644 --- a/src/components/MTableActions/index.js +++ b/src/components/MTableActions/index.js @@ -32,6 +32,7 @@ function MTableActions({ } MTableActions.propTypes = { + columns: PropTypes.array, components: PropTypes.object.isRequired, actions: PropTypes.array.isRequired, data: PropTypes.oneOfType([ @@ -39,6 +40,7 @@ MTableActions.propTypes = { PropTypes.arrayOf(PropTypes.object) ]), disabled: PropTypes.bool, + onColumnsChanged: PropTypes.func, size: PropTypes.string, forwardedRef: PropTypes.element }; diff --git a/src/utils/data-manager.js b/src/utils/data-manager.js index 28816a02..8e394228 100644 --- a/src/utils/data-manager.js +++ b/src/utils/data-manager.js @@ -1110,14 +1110,20 @@ export default class DataManager { if (!group) { const path = [...(o.path || []), value]; + let isDefaultExpanded = false; + switch (typeof this.defaultExpanded) { + case 'boolean': + isDefaultExpanded = this.defaultExpanded; + break; + case 'function': + isDefaultExpanded = this.defaultExpanded(currentRow); + break; + } const oldGroup = this.findGroupByGroupPath( this.groupedData, path ) || { - isExpanded: - typeof this.defaultExpanded === 'boolean' - ? this.defaultExpanded - : false + isExpanded: isDefaultExpanded }; group = { @@ -1227,10 +1233,15 @@ export default class DataManager { !this.columns.some((columnDef) => columnDef.tableData.filterValue) ) { if (rowData.tableData.isTreeExpanded === undefined) { - const isExpanded = - typeof this.defaultExpanded === 'boolean' - ? this.defaultExpanded - : this.defaultExpanded(rowData); + let isExpanded = false; + switch (typeof this.defaultExpanded) { + case 'boolean': + isDefaultExpanded = this.defaultExpanded; + break; + case 'function': + isDefaultExpanded = this.defaultExpanded(rowData); + break; + } rowData.tableData.isTreeExpanded = isExpanded; } }