From a1b113b4e57bf77eaeea231e45b3dff6207b0c30 Mon Sep 17 00:00:00 2001 From: loughlinclaus3 <108533329+loughlinclaus3@users.noreply.github.com> Date: Sun, 1 Sep 2024 13:26:53 -0400 Subject: [PATCH 1/6] removed isRequired from columns (#861) - also, removed isRequired from MtableActions' onColumnsChanged propType, as it caused the same issue --- src/components/MTableAction/index.js | 4 ++-- src/components/MTableActions/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/MTableAction/index.js b/src/components/MTableAction/index.js index 9c3ee674..f0162a28 100644 --- a/src/components/MTableAction/index.js +++ b/src/components/MTableAction/index.js @@ -99,13 +99,13 @@ const defaultProps = { MTableAction.propTypes = { action: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired, - columns: PropTypes.array.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 a89e79df..821c97bb 100644 --- a/src/components/MTableActions/index.js +++ b/src/components/MTableActions/index.js @@ -32,7 +32,7 @@ function MTableActions({ } MTableActions.propTypes = { - columns: PropTypes.array.isRequired, + columns: PropTypes.array, components: PropTypes.object.isRequired, actions: PropTypes.array.isRequired, data: PropTypes.oneOfType([ @@ -40,7 +40,7 @@ MTableActions.propTypes = { PropTypes.arrayOf(PropTypes.object) ]), disabled: PropTypes.bool, - onColumnsChanged: PropTypes.func.isRequired, + onColumnsChanged: PropTypes.func, size: PropTypes.string, forwardedRef: PropTypes.element }; From e117ab07f7f24cc8e800e3c115e9b6f5bcea5bca Mon Sep 17 00:00:00 2001 From: Domino987 Date: Mon, 14 Oct 2024 10:00:35 +0200 Subject: [PATCH 2/6] make defaultExpanded alsways respect function --- src/utils/data-manager.js | 58 +++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/src/utils/data-manager.js b/src/utils/data-manager.js index 28816a02..8a35c47e 100644 --- a/src/utils/data-manager.js +++ b/src/utils/data-manager.js @@ -176,8 +176,8 @@ export default class DataManager { this.tableStyleWidth = this.tableWidth === 'full' || - undefWidthCols.length > 0 || - usedWidthNotPx.length > 0 + undefWidthCols.length > 0 || + usedWidthNotPx.length > 0 ? '100%' : usedWidthPx; } @@ -930,7 +930,7 @@ export default class DataManager { this.treefied = this.sorted = this.paged = - false; + false; this.filteredData = [...this.data]; @@ -1110,14 +1110,21 @@ 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 +1234,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; } } @@ -1279,19 +1291,19 @@ export default class DataManager { return list.sort( columnDef.tableData.groupSort === 'desc' ? (a, b) => - columnDef.customSort( - b.value, - a.value, - 'group', - columnDef.tableData.groupSort - ) + columnDef.customSort( + b.value, + a.value, + 'group', + columnDef.tableData.groupSort + ) : (a, b) => - columnDef.customSort( - a.value, - b.value, - 'group', - columnDef.tableData.groupSort - ) + columnDef.customSort( + a.value, + b.value, + 'group', + columnDef.tableData.groupSort + ) ); } else { return list.sort( From cf9cdf923d62e7d89d3312dac62abd3a0f53f87e Mon Sep 17 00:00:00 2001 From: Domino987 Date: Mon, 14 Oct 2024 10:03:37 +0200 Subject: [PATCH 3/6] revert test change --- src/utils/data-manager.js | 60 ++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/src/utils/data-manager.js b/src/utils/data-manager.js index 8a35c47e..9eeec772 100644 --- a/src/utils/data-manager.js +++ b/src/utils/data-manager.js @@ -176,8 +176,8 @@ export default class DataManager { this.tableStyleWidth = this.tableWidth === 'full' || - undefWidthCols.length > 0 || - usedWidthNotPx.length > 0 + undefWidthCols.length > 0 || + usedWidthNotPx.length > 0 ? '100%' : usedWidthPx; } @@ -930,7 +930,7 @@ export default class DataManager { this.treefied = this.sorted = this.paged = - false; + false; this.filteredData = [...this.data]; @@ -1110,21 +1110,14 @@ 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: isDefaultExpanded + isExpanded: + typeof this.defaultExpanded === 'boolean' + ? this.defaultExpanded + : false }; group = { @@ -1234,15 +1227,10 @@ export default class DataManager { !this.columns.some((columnDef) => columnDef.tableData.filterValue) ) { if (rowData.tableData.isTreeExpanded === undefined) { - let isExpanded = false; - switch (typeof this.defaultExpanded) { - case "boolean": - isDefaultExpanded = this.defaultExpanded; - break; - case "function": - isDefaultExpanded = this.defaultExpanded(rowData); - break; - } + const isExpanded = + typeof this.defaultExpanded === 'boolean' + ? this.defaultExpanded + : this.defaultExpanded(rowData); rowData.tableData.isTreeExpanded = isExpanded; } } @@ -1291,19 +1279,19 @@ export default class DataManager { return list.sort( columnDef.tableData.groupSort === 'desc' ? (a, b) => - columnDef.customSort( - b.value, - a.value, - 'group', - columnDef.tableData.groupSort - ) + columnDef.customSort( + b.value, + a.value, + 'group', + columnDef.tableData.groupSort + ) : (a, b) => - columnDef.customSort( - a.value, - b.value, - 'group', - columnDef.tableData.groupSort - ) + columnDef.customSort( + a.value, + b.value, + 'group', + columnDef.tableData.groupSort + ) ); } else { return list.sort( @@ -1415,4 +1403,4 @@ export default class DataManager { this.changeSearchText(''); this.changePaging(0); }; -} +} \ No newline at end of file From 29a8cc0a285b9f9b045a869bed2248d2d50b5bf2 Mon Sep 17 00:00:00 2001 From: Domino987 Date: Tue, 15 Oct 2024 16:03:38 +0200 Subject: [PATCH 4/6] isDefaultExpanded for for groups (#873) --- src/utils/data-manager.js | 60 +++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/utils/data-manager.js b/src/utils/data-manager.js index 9eeec772..8a35c47e 100644 --- a/src/utils/data-manager.js +++ b/src/utils/data-manager.js @@ -176,8 +176,8 @@ export default class DataManager { this.tableStyleWidth = this.tableWidth === 'full' || - undefWidthCols.length > 0 || - usedWidthNotPx.length > 0 + undefWidthCols.length > 0 || + usedWidthNotPx.length > 0 ? '100%' : usedWidthPx; } @@ -930,7 +930,7 @@ export default class DataManager { this.treefied = this.sorted = this.paged = - false; + false; this.filteredData = [...this.data]; @@ -1110,14 +1110,21 @@ 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 +1234,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; } } @@ -1279,19 +1291,19 @@ export default class DataManager { return list.sort( columnDef.tableData.groupSort === 'desc' ? (a, b) => - columnDef.customSort( - b.value, - a.value, - 'group', - columnDef.tableData.groupSort - ) + columnDef.customSort( + b.value, + a.value, + 'group', + columnDef.tableData.groupSort + ) : (a, b) => - columnDef.customSort( - a.value, - b.value, - 'group', - columnDef.tableData.groupSort - ) + columnDef.customSort( + a.value, + b.value, + 'group', + columnDef.tableData.groupSort + ) ); } else { return list.sort( @@ -1403,4 +1415,4 @@ export default class DataManager { this.changeSearchText(''); this.changePaging(0); }; -} \ No newline at end of file +} From dc67448b9b4674cc14b8b9ae9dfeed55de8b2e6b Mon Sep 17 00:00:00 2001 From: Conner Owen Date: Thu, 17 Oct 2024 05:33:45 -0600 Subject: [PATCH 5/6] Fix disabled tooltip (#850) Co-authored-by: Domino987 --- src/components/MTableAction/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/MTableAction/index.js b/src/components/MTableAction/index.js index f0162a28..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} From 53e029f84b2e1bd237b787e32cd70c8b95a64c18 Mon Sep 17 00:00:00 2001 From: Domino987 Date: Thu, 17 Oct 2024 13:34:47 +0200 Subject: [PATCH 6/6] Update README.md (#874) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a262ce28..e7ecac21 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)!