Skip to content

Commit

Permalink
Merge branch 'master' of github.com:material-table-core/core
Browse files Browse the repository at this point in the history
  • Loading branch information
Domino987 committed Oct 17, 2024
2 parents a4a7558 + 53e029f commit 73a83c0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Please review our [roadmap](https://github.com/material-table-core/core/wiki/Roa

</div>

# 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)!
Expand Down
5 changes: 3 additions & 2 deletions src/components/MTableAction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
<Tooltip title={action.tooltip}>
<span>{button}</span>
</Tooltip>
Expand All @@ -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
};

Expand Down
2 changes: 2 additions & 0 deletions src/components/MTableActions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ function MTableActions({
}

MTableActions.propTypes = {
columns: PropTypes.array,
components: PropTypes.object.isRequired,
actions: PropTypes.array.isRequired,
data: PropTypes.oneOfType([
PropTypes.object,
PropTypes.arrayOf(PropTypes.object)
]),
disabled: PropTypes.bool,
onColumnsChanged: PropTypes.func,
size: PropTypes.string,
forwardedRef: PropTypes.element
};
Expand Down
27 changes: 19 additions & 8 deletions src/utils/data-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 73a83c0

Please sign in to comment.