Skip to content

Commit

Permalink
chore(react-grid): remove the 'getMessage' prop from table header cell (
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyAlexeev committed Jan 16, 2019
1 parent b9f1a0a commit d8a2eea
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 39 deletions.
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
### BREAKING CHANGES

* **react-chart:**
Previously the `ArgumenAxis`, `ValueAxis`, and `Scale` plugins allowed you to customize argument and value scales. In this release, we have implemented the `ArgumentScale` and `ValueScale` plugins for this purpose to make the API more clear.
Previously the `ArgumentAxis`, `ValueAxis`, and `Scale` plugins allowed you to customize argument and value scales. In this release, we have implemented the `ArgumentScale` and `ValueScale` plugins for this purpose.

* **react-chart:**
The `showGrids` *Axis* property is renamed to `showGrid`.
Expand All @@ -36,16 +36,16 @@ The `showGrids` *Axis* property is renamed to `showGrid`.
The `min` and `max` scale properties are replaced with the `modifyDomain` property because the *band* scale domain cannot be customized in *min* and *max* terms.

Replace this

```javascript
<ArgumentScale min={0} max={10} ... />
```

with this

```javascript
const modifyDomain = () => [0, 10];
<ArgumentScale modifyDomain={modifyDomain} ... />
```

Expand Down Expand Up @@ -216,7 +216,10 @@ To configure a band scale, use the `Scale` plugin as follows:
* **react-grid:** extract sorting control ([#881](https://github.com/DevExpress/devextreme-reactive/issues/881)) ([2a6dd1a](https://github.com/DevExpress/devextreme-reactive/commit/2a6dd1a))
* **react-grid:** support columns fixing ([#1305](https://github.com/DevExpress/devextreme-reactive/issues/1305)) ([81c13a4](https://github.com/DevExpress/devextreme-reactive/commit/81c13a4))
### BREAKING CHANGES
* **react-grid:**
Because we extracted the sorting control, the `getMessage` property was moved from the `TableHeaderRow.CellProps` interface to `TableHeaderRow.SortLabelProps`. This property returns the sort label's text.
<a name="1.7.2"></a>
# [1.7.2](https://github.com/DevExpress/devextreme-reactive/compare/v1.7.1...v1.7.2) (2018-08-31)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class TableHeaderCell extends React.PureComponent {
showGroupingControls, onGroup, groupingEnabled,
draggingEnabled, resizingEnabled,
onWidthChange, onWidthDraft, onWidthDraftCancel,
tableRow, getMessage, children,
tableRow, children,
// @deprecated
showSortingControls, sortingDirection, sortingEnabled, onSort, before,
...restProps
Expand Down Expand Up @@ -102,7 +102,6 @@ TableHeaderCell.propTypes = {
onWidthChange: PropTypes.func,
onWidthDraft: PropTypes.func,
onWidthDraftCancel: PropTypes.func,
getMessage: PropTypes.func,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
Expand All @@ -127,7 +126,6 @@ TableHeaderCell.defaultProps = {
onWidthChange: undefined,
onWidthDraft: undefined,
onWidthDraftCancel: undefined,
getMessage: undefined,
children: undefined,
before: undefined,
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class TableHeaderCell extends React.PureComponent {
showGroupingControls, onGroup, groupingEnabled,
draggingEnabled, onWidthDraftCancel,
resizingEnabled, onWidthChange, onWidthDraft,
tableRow, getMessage, children,
tableRow, children,
// @deprecated
showSortingControls, sortingDirection, sortingEnabled, onSort, before,
...restProps
Expand Down Expand Up @@ -96,7 +96,6 @@ TableHeaderCell.propTypes = {
onWidthChange: PropTypes.func,
onWidthDraft: PropTypes.func,
onWidthDraftCancel: PropTypes.func,
getMessage: PropTypes.func,
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node,
Expand All @@ -121,6 +120,5 @@ TableHeaderCell.defaultProps = {
onWidthChange: undefined,
onWidthDraft: undefined,
onWidthDraftCancel: undefined,
getMessage: undefined,
children: undefined,
};
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class TableHeaderCellBase extends React.PureComponent {
showGroupingControls, onGroup, groupingEnabled,
draggingEnabled,
resizingEnabled, onWidthChange, onWidthDraft, onWidthDraftCancel,
classes, getMessage, tableRow, className, children,
classes, tableRow, className, children,
// @deprecated
showSortingControls, sortingDirection, sortingEnabled, onSort, before,
...restProps
Expand Down Expand Up @@ -186,7 +186,6 @@ TableHeaderCellBase.propTypes = {
onWidthDraft: PropTypes.func,
onWidthDraftCancel: PropTypes.func,
classes: PropTypes.object.isRequired,
getMessage: PropTypes.func.isRequired,
className: PropTypes.string,
children: PropTypes.node,
before: PropTypes.node,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TableHeaderCell } from './table-header-cell';
import { ResizingControl } from './table-header-cell/resizing-control';

const defaultProps = {
getMessage: key => key,
column: { name: 'Test' },
};

Expand Down
1 change: 0 additions & 1 deletion packages/dx-react-grid/docs/reference/table-header-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ onWidthChange | (parameters: { shift: number }) => void | An event that initiate
onWidthDraft | (parameters: { shift: number }) => void | An event that changes the column width used for preview. The initial column width increases by the `shift` value or decreases if `shift` is less than zero.
onWidthDraftCancel | () => void | An event that cancels the column width change used for preview.
draggingEnabled | boolean | Specifies whether drag-and-drop is enabled.
getMessage | ([messageKey](#localization-messages): string) => string | Returns the sort label's text.
children | ReactNode | The header cell's children.
showSortingControls | boolean | **@deprecated** <br/> Specifies whether to render controls that toggle the column's sorting state.
sortingEnabled | boolean | **@deprecated** <br/> Specifies whether sorting by the column is enabled.
Expand Down
1 change: 0 additions & 1 deletion packages/dx-react-grid/src/plugins/table-header-row.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class TableHeaderRow extends React.PureComponent {
<HeaderCell
{...params}
column={params.tableColumn.column}
getMessage={getMessage}
draggingEnabled={draggingEnabled && atLeastOneDataColumn}
resizingEnabled={tableColumnResizingEnabled}
onWidthChange={({ shift }) => changeTableColumnWidth({ columnName, shift })}
Expand Down
23 changes: 0 additions & 23 deletions packages/dx-react-grid/src/plugins/table-header-row.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,6 @@ describe('TableHeaderRow', () => {
.toMatchObject(defaultDeps.template.tableRow);
});

it('should pass correct getMessage prop to TableHeaderRowTemplate', () => {
isHeadingTableCell.mockImplementation(() => true);

const deps = {
plugins: ['SortingState'],
};
const tree = mount((
<PluginHost>
{pluginDepsToComponents(defaultDeps, deps)}
<TableHeaderRow
{...defaultProps}
showSortingControls
messages={{
sortingHint: 'test',
}}
/>
</PluginHost>
));

const { getMessage } = tree.find(defaultProps.cellComponent).props();
expect(getMessage('sortingHint')).toBe('test');
});

describe('resizing', () => {
it('should pass correct props to cellComponent', () => {
isHeadingTableCell.mockImplementation(() => true);
Expand Down

0 comments on commit d8a2eea

Please sign in to comment.