|
3 | 3 | All notable changes to this project will be documented in this file.
|
4 | 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5 | 5 |
|
| 6 | +## 5.0.0-beta.4 |
| 7 | + |
| 8 | +_Oct 14, 2021_ |
| 9 | + |
| 10 | +A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨: |
| 11 | + |
| 12 | +- 🎁 Add the ability to print the grid (#2519) @DanailH |
| 13 | + |
| 14 | + This new feature adds a button to the toolbar to generate a printer-friendly layout. Check the [documentation](https://mui.com/components/data-grid/export/#print) about it. |
| 15 | + |
| 16 | +- 💡 Enhance internal code structure |
| 17 | +- ✨ New slots for `row` and `cell` (#2753) @m4theushw |
| 18 | +- 📚 Documentation improvements |
| 19 | +- 🐞 Bugfixes |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +#### Breaking changes |
| 24 | + |
| 25 | +- [DataGrid] Remove unused event listeners and redundant DOM attributes on `GridCell` and `GridRow` (#2810) @m4theushw |
| 26 | + |
| 27 | + The following props were removed. If you depend on them, use `componentsProps.row` and `componentsProps.cell` to pass custom props to the row or cell. |
| 28 | + |
| 29 | + - `onCellBlur` |
| 30 | + - `onCellOver` |
| 31 | + - `onCellOut` |
| 32 | + - `onCellEnter` |
| 33 | + - `onCellLeave` |
| 34 | + - `onRowOver` |
| 35 | + - `onRowOut` |
| 36 | + - `onRowEnter` |
| 37 | + - `onRowLeave` |
| 38 | + |
| 39 | + For more information, check [this page](https://mui.com/components/data-grid/components/#row). Example: |
| 40 | + |
| 41 | + ```diff |
| 42 | + -<DataGrid onRowOver={handleRowOver} />; |
| 43 | + +<DataGrid |
| 44 | + + componentsProps={{ |
| 45 | + + row: { onMouseOver: handleRowOver }, |
| 46 | + + }} |
| 47 | + +/>; |
| 48 | + ``` |
| 49 | + |
| 50 | + The `data-rowindex` and `data-rowselected` attributes were removed from the cell element. Equivalent attributes can be found in the row element. |
| 51 | + |
| 52 | + The `data-editable` attribute was removed from the cell element. Use the `.MuiDataGrid-cell--editable` CSS class. |
| 53 | + |
| 54 | + The `data-mode` attribute was removed from the cell element. Use the `.MuiDataGrid-cell--editing` CSS class. |
| 55 | + |
| 56 | +- [DataGrid] The `state.filter` and `state.visibleRows` were merged into a single `state.filter` sub-state (#2782) @flaviendelangle |
| 57 | + |
| 58 | + To still access this information, use `state.filter` or the selectors as below: |
| 59 | + |
| 60 | + ```diff |
| 61 | + -const filterModel = state.filter |
| 62 | + -const filterModel = gridFilterStateSelector(state) |
| 63 | + +const filterModel = state.filter.filterModel |
| 64 | + +const filterModel = gridFilterModelSelector(state) // preferred method |
| 65 | + |
| 66 | + -const visibleRowsLookup = state.visibleRows.visibleRowsLookup |
| 67 | + -const visibleRowsLookup = visibleGridRowsStateSelector(state).visibleRowsLookup |
| 68 | + +const visibleRowsLookup = state.filter.visibleRowsLookup |
| 69 | + +const visibleRowsLookup = gridVisibleRowsLookupSelector(state).visibleRowsLookup // preferred method |
| 70 | + |
| 71 | + -const visibleRows = state.visibleRows.visibleRows |
| 72 | + +const visibleRows = state.filter.visibleRows |
| 73 | + +const visibleRows = gridVisibleRowsLookupSelector(state).visibleRows // preferred method |
| 74 | + ``` |
| 75 | + |
| 76 | +- [DataGrid] The CSS classes constants are not exported anymore. Use `gridClasses` instead. (#2788) @flaviendelangle |
| 77 | + |
| 78 | + ```diff |
| 79 | + -const columnHeaderClass = GRID_COLUMN_HEADER_CSS_CLASS |
| 80 | + +const columnHeaderClass = gridClasses.columnHeader |
| 81 | + |
| 82 | + -const rowClass = GRID_ROW_CSS_CLASS |
| 83 | + +const rowClass = gridClasses.row |
| 84 | + |
| 85 | + -const cellClass = GRID_CELL_CSS_CLASS |
| 86 | + +const cellClass = gridClasses.cell |
| 87 | + |
| 88 | + -const columnSeparatorClass = GRID_COLUMN_HEADER_SEPARATOR_RESIZABLE_CSS_CLASS |
| 89 | + +const columnSeparatorClass = gridClasses['columnSeparator--resizable'] |
| 90 | + |
| 91 | + -const columnHeaderTitleClass = GRID_COLUMN_HEADER_TITLE_CSS_CLASS |
| 92 | + +const columnHeaderTitleClass = gridClasses.columnHeaderTitle |
| 93 | + |
| 94 | + -const columnHeaderDropZoneClass = GRID_COLUMN_HEADER_DROP_ZONE_CSS_CLASS |
| 95 | + +const columnHeaderDropZoneClass = gridClasses.columnHeaderDropZone |
| 96 | + |
| 97 | + -const columnHeaderDraggingClass = GRID_COLUMN_HEADER_DRAGGING_CSS_CLASS |
| 98 | + +const columnHeaderDraggingClass = gridClasses["columnHeader--dragging"] |
| 99 | + ``` |
| 100 | + |
| 101 | +- [DataGrid] Rename `gridCheckboxSelectionColDef` to `GRID_CHECKBOX_SELECTION_COL_DEF` (#2793) @flaviendelangle |
| 102 | + |
| 103 | + ```diff |
| 104 | + - gridCheckboxSelectionColDef |
| 105 | + + GRID_CHECKBOX_SELECTION_COL_DEF |
| 106 | + ``` |
| 107 | + |
| 108 | +- [DataGrid] The constants referring to the column types were removed (#2791) @flaviendelangle |
| 109 | + Replace them as below: |
| 110 | + |
| 111 | + ```diff |
| 112 | + -const isColumnString = column.type === GRID_STRING_COLUMN_TYPE; |
| 113 | + +const isColumnString = col.type === 'string'; |
| 114 | + |
| 115 | + -const isColumnNumber = col.type === GRID_NUMBER_COLUMN_TYPE; |
| 116 | + +const isColumnNumber = col.type === 'number'; |
| 117 | + |
| 118 | + -const isColumnDate = col.type === GRID_DATE_COLUMN_TYPE; |
| 119 | + +const isColumnDate = col.type === 'date'; |
| 120 | + |
| 121 | + -const isColumnDateTime = col.type === GRID_DATETIME_COLUMN_TYPE; |
| 122 | + +const isColumnDateTime = col.type === 'dateTime'; |
| 123 | + |
| 124 | + -const isColumnBoolean = col.type === GRID_BOOLEAN_COLUMN_TYPE; |
| 125 | + +const isColumnBoolean = col.type === 'boolean'; |
| 126 | + ``` |
| 127 | + |
| 128 | +- [DataGrid] The state initializers were removed (#2782) @flaviendelangle |
| 129 | + |
| 130 | + Use `getDefaultGridFilterModel` instead of `getInitialGridFilterState`: |
| 131 | + |
| 132 | + ```diff |
| 133 | + -const [filterModel, setFilterModel] = React.useState(getInitialGridFilterState); |
| 134 | + +const [filterModel, setFilterModel] = React.useState(getDefaultGridFilterModel); |
| 135 | + ``` |
| 136 | + |
| 137 | + For the other methods, you can hardcode the value you want to apply: |
| 138 | + |
| 139 | + ```diff |
| 140 | + -const [sortModel, setSortModel] = React.useState(() => getInitialGridSortingState().sortModel); |
| 141 | + +const [sortModel, setSortModel] React.useState([]); |
| 142 | + |
| 143 | + -getInitialGridColumnReorderState |
| 144 | + -getInitialGridColumnResizeState |
| 145 | + -getInitialGridColumnsState |
| 146 | + -getInitialGridRenderingState |
| 147 | + -getInitialGridRowState |
| 148 | + -getInitialGridState |
| 149 | + -getInitialVisibleGridRowsState |
| 150 | + -getInitialGridState |
| 151 | + ``` |
| 152 | + |
| 153 | +#### Changes |
| 154 | + |
| 155 | +- [DataGrid] Add `row` and `cell` component slots (#2753) @m4theushw |
| 156 | +- [DataGrid] Rename `gridCheckboxSelectionColDef` to `GRID_CHECKBOX_SELECTION_COL_DEF` (#2793) @flaviendelangle |
| 157 | +- [DataGrid] Clean hook folder structure and stop exporting internal hooks (#2789) @flaviendelangle |
| 158 | +- [DataGrid] Add support for Print export (#2519) @DanailH |
| 159 | +- [DataGrid] Remove internal localization and column type constant exports (#2791) @flaviendelangle |
| 160 | +- [DataGrid] Remove `GridRowCells` component (#2811) @m4theushw |
| 161 | +- [DataGrid] Remove class constants exports (#2788) @flaviendelangle |
| 162 | +- [DataGrid] Remove unused event listeners on `GridCell` and `GridRow` (#2810) @m4theushw |
| 163 | +- [DataGrid] Fix the header selection checkbox to work with `prop.checkboxSelectionVisibleOnly` (#2781) @flaviendelangle |
| 164 | + |
| 165 | +### Docs |
| 166 | + |
| 167 | +- [docs] Add link to installation page (#2778) @MostafaKMilly |
| 168 | +- [docs] Add redirect from docs home page to `DataGrid` home page (#2737) @flaviendelangle |
| 169 | +- [docs] Fix JSX closing tag in `getActions` example (#2847) @dstarner |
| 170 | +- [docs] Fix pagination in Ant Design demo (#2787) @ZeeshanTamboli |
| 171 | +- [docs] Update the `page` prop docs (#2812) @m4theushw |
| 172 | + |
| 173 | +### Core |
| 174 | + |
| 175 | +- [core] Update hooks to initialize their state synchronously (#2782) @flaviendelangle |
| 176 | +- [core] Fix rollup external warnings (#2736) @eps1lon |
| 177 | + |
6 | 178 | ## 5.0.0-beta.3
|
7 | 179 |
|
8 | 180 | _Oct 7, 2021_
|
|
0 commit comments