From a80838cc4c4a921c46409bda9e01a43b8ffc77e1 Mon Sep 17 00:00:00 2001 From: KippWade <43067502+KippWade@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:11:34 -0500 Subject: [PATCH 1/4] Add onRowDeleteCancelled prop (#822) add "missing" onRowDeleteCancelled, to match onRowAddCancelled and onRowUpdateCancelled. --- src/material-table.js | 2 ++ src/prop-types.js | 1 + types/index.d.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/src/material-table.js b/src/material-table.js index 7e936e09..7d14c3e8 100644 --- a/src/material-table.js +++ b/src/material-table.js @@ -693,6 +693,8 @@ export default class MaterialTable extends React.Component { this.dataManager.changeRowEditing(rowData); this.setState(this.dataManager.getRenderState()); } else if (mode === 'delete') { + this.props.editable.onRowDeleteCancelled && + this.props.editable.onRowDeleteCancelled(rowData); this.dataManager.changeRowEditing(rowData); this.setState(this.dataManager.getRenderState()); } diff --git a/src/prop-types.js b/src/prop-types.js index 19f10b47..df18fda2 100644 --- a/src/prop-types.js +++ b/src/prop-types.js @@ -203,6 +203,7 @@ export const propTypes = { onRowUpdate: PropTypes.func, onRowDelete: PropTypes.func, onRowAddCancelled: PropTypes.func, + onRowDeleteCancelled: PropTypes.func, onRowUpdateCancelled: PropTypes.func, isEditHidden: PropTypes.func, isDeleteHidden: PropTypes.func diff --git a/types/index.d.ts b/types/index.d.ts index 6a7a57fc..8a67b7a0 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -51,6 +51,7 @@ export interface MaterialTableProps { editTooltip?: (rowData: RowData) => string; deleteTooltip?: (rowData: RowData) => string; onRowAddCancelled?: (rowData: RowData) => void; + onRowDeleteCancelled?: (rowData: RowData) => void; onRowUpdateCancelled?: (rowData: RowData) => void; isEditHidden?: (rowData: RowData) => boolean; isDeleteHidden?: (rowData: RowData) => boolean; From 6fb01f59b0c6e1702473d443a5d33fdc9da7b8d1 Mon Sep 17 00:00:00 2001 From: KippWade <43067502+KippWade@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:35:21 -0500 Subject: [PATCH 2/4] Update material-table.js (#823) Create check if consumer uses depreciated prop, instead of issuing waring automatically. --- src/material-table.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/material-table.js b/src/material-table.js index 7d14c3e8..0f3a3bb5 100644 --- a/src/material-table.js +++ b/src/material-table.js @@ -465,9 +465,15 @@ export default class MaterialTable extends React.Component { (a) => a.tableData.id === orderBy ); query.orderDirection = orderDirection; - console.warn( - 'Properties orderBy and orderDirection had been deprecated when remote data, please start using orderByCollection instead' - ); + /** + * THIS WILL NEED TO BE REMOVED EVENTUALLY. + * Warn consumer of deprecated prop. + */ + if (query.orderDirection !== undefined || query.orderBy !== undefined) { + console.warn( + 'Properties orderBy and orderDirection had been deprecated when remote data, please start using orderByCollection instead' + ); + } query.orderByCollection = orderByCollection; this.onQueryChange(query, () => { this.props.onOrderChange && From 5134fb4b38ae63a14826750321f9c8f0b6c12aa6 Mon Sep 17 00:00:00 2001 From: JeanZap Date: Thu, 8 Feb 2024 06:33:44 -0300 Subject: [PATCH 3/4] Adding options.actionsCellStyle to Cell also when editing row (#831) Co-authored-by: Jean Pereira Co-authored-by: Domino987 --- src/components/MTableEditRow/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/MTableEditRow/index.js b/src/components/MTableEditRow/index.js index 037a7b48..5e6ccdc6 100644 --- a/src/components/MTableEditRow/index.js +++ b/src/components/MTableEditRow/index.js @@ -181,7 +181,8 @@ function MTableEditRow(props) { style={{ width: 42 * actions.length, padding: '0px 5px', - ...options.editCellStyle + ...options.editCellStyle, + ...options.actionsCellStyle }} > Date: Wed, 27 Mar 2024 14:30:42 +0100 Subject: [PATCH 4/4] Update dependencies (#836) Co-authored-by: Christian Da Silva Perez --- package.json | 8 ++++---- src/components/MTableEditField/DateField.js | 2 +- src/components/MTableFilterRow/DateFilter.js | 2 +- src/components/m-table-edit-field.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1df45998..11abd39d 100644 --- a/package.json +++ b/package.json @@ -106,17 +106,17 @@ }, "dependencies": { "@babel/runtime": "^7.19.0", - "@date-io/core": "^2.16.0", - "@date-io/date-fns": "^2.16.0", + "@date-io/core": "^3.0.0", + "@date-io/date-fns": "^3.0.0", "@emotion/core": "^11.0.0", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", "@hello-pangea/dnd": "^16.0.0", "@mui/icons-material": ">=5.10.6", "@mui/material": ">=5.11.12", - "@mui/x-date-pickers": "^5.0.3", + "@mui/x-date-pickers": "^6.19.0", "classnames": "^2.3.2", - "date-fns": "^2.29.3", + "date-fns": "^3.2.0", "debounce": "^1.2.1", "deep-eql": "^4.1.1", "deepmerge": "^4.2.2", diff --git a/src/components/MTableEditField/DateField.js b/src/components/MTableEditField/DateField.js index 3bdfeb83..c83cfd14 100644 --- a/src/components/MTableEditField/DateField.js +++ b/src/components/MTableEditField/DateField.js @@ -1,5 +1,5 @@ import React from 'react'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; +import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'; import { TextField } from '@mui/material'; import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers'; diff --git a/src/components/MTableFilterRow/DateFilter.js b/src/components/MTableFilterRow/DateFilter.js index 4d73873a..0e28246f 100644 --- a/src/components/MTableFilterRow/DateFilter.js +++ b/src/components/MTableFilterRow/DateFilter.js @@ -1,5 +1,5 @@ import React from 'react'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; +import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'; import TextField from '@mui/material/TextField'; import { getLocalizedFilterPlaceHolder } from './utils'; import { diff --git a/src/components/m-table-edit-field.js b/src/components/m-table-edit-field.js index cba49618..1485439f 100644 --- a/src/components/m-table-edit-field.js +++ b/src/components/m-table-edit-field.js @@ -7,7 +7,7 @@ import FormControl from '@mui/material/FormControl'; import FormHelperText from '@mui/material/FormHelperText'; import FormGroup from '@mui/material/FormGroup'; import FormControlLabel from '@mui/material/FormControlLabel'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; +import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'; import { LocalizationProvider, TimePicker,