Browse Source

site: indent code block

pull/8432/head
Wei Zhu 7 years ago
parent
commit
6ed30ada37
  1. 90
      CHANGELOG.en-US.md
  2. 106
      CHANGELOG.zh-CN.md

90
CHANGELOG.en-US.md

@ -38,30 +38,30 @@ timeline: true
- Form `getFieldDecorator`'s `exclusive` option has been removeed.
- Added `Form.createFormField`, and you must use it to wrap field data returned in `option.mapPropsToFields`:
```diff
import { Form } from 'antd';
Form.create({
mapPropsToFields() {
return {
- name: { value: 'antd' },
+ name: Form.createFormField({ value: 'antd' }),
};
},
})
```
```diff
import { Form } from 'antd';
Form.create({
mapPropsToFields() {
return {
- name: { value: 'antd' },
+ name: Form.createFormField({ value: 'antd' }),
};
},
})
```
- Improved global reset style, if you encounter style problem after upgrading, you can try import our v2 compatible style.
```javascript
import 'antd/style/v2-compatible-reset';
```
```javascript
import 'antd/style/v2-compatible-reset';
```
Or use less
Or use less
```less
@import '~antd/style/v2-compatible-reset.css';
```
```less
@import '~antd/style/v2-compatible-reset.css';
```
- Since we changed default locale to en_US, LocalProvider is not required any more for English users.
- We don't set `size="large"` to `Input` in `Form` by default any more.
@ -109,24 +109,24 @@ Or use less
- 🌟 Added new `focusOnOpen` prop to focus input after panel is open.
- Table
- 🌟 Added new `components` prop to allow overriding default table elements.
```javascript
// You can override following elements
const components = {
table: MyTable,
header: {
wrapper: HeaderWrapper,
row: HeaderRow,
cell: HeaderCell,
},
body: {
wrapper: BodyWrapper,
row: BodyRow,
cell: BodyCell,
},
};
```javascript
// You can override following elements
const components = {
table: MyTable,
header: {
wrapper: HeaderWrapper,
row: HeaderRow,
cell: HeaderCell,
},
body: {
wrapper: BodyWrapper,
row: BodyRow,
cell: BodyCell,
},
};
<Table components={components} columns={columns data={data}} />
```
<Table components={components} columns={columns data={data}} />
```
- 🌟 Added new `onRow` prop to allow passing custom props to table body row.
- 🌟 Added new `onHeaderRow` props to allow passing custom props to table header row.
- 🌟 Added `column[onCell]` to allow passing custom props to table body cell.
@ -136,15 +136,15 @@ Or use less
- 🌟 Added `rowSelection[fixed]` to allow fixing the selection column.。
- 🙅 Deprecated `getBodyWrapper`, please use `components` instead.
- 🙅 Deprecated `onRowClick`,`onRowDoubleClick`、`onRowContextMenu`、`onRowMouseEnter`、`onRowMouseLeave`, please use `onRow` instead.
```javascript
<Table onRow={(record) => ({
onClick: () => {},
onDoubleClick: () => {},
onContextMenu: () => {},
onMouseEnter: () => {},
onMouseLeave: () => {},
})} />
```
```javascript
<Table onRow={(record) => ({
onClick: () => {},
onDoubleClick: () => {},
onContextMenu: () => {},
onMouseEnter: () => {},
onMouseLeave: () => {},
})} />
```
- Select
- 🌟 Option's value can be a number in single or multiple mode.
- 🌟 Added new `maxTagCount` and `maxTagPlaceholder` props.

106
CHANGELOG.zh-CN.md

@ -38,42 +38,42 @@ timeline: true
- Form `getFieldDecorator``exclusive` 参数被移除,此类场景应该由 Radio.Group、Checkbox.Group 之类的组件来完成。
- 新增 `Form.createFormField` 方法,`mapPropsToFields` 返回的字段都需要由该方法创建。
```diff
import { Form } from 'antd';
Form.create({
mapPropsToFields() {
return {
- name: { value: 'antd' },
+ name: Form.createFormField({ value: 'antd' }),
};
},
})
```
```diff
import { Form } from 'antd';
Form.create({
mapPropsToFields() {
return {
- name: { value: 'antd' },
+ name: Form.createFormField({ value: 'antd' }),
};
},
})
```
- 优化了全局的重置样式,如果升级后你的全局样式有问题,可以引入我们提供的 2.x 兼容样式。
```javascript
import 'antd/style/v2-compatible-reset';
```
```javascript
import 'antd/style/v2-compatible-reset';
```
或者在 less 里引入
或者在 less 里引入
```less
@import '~antd/style/v2-compatible-reset.css';
```
```less
@import '~antd/style/v2-compatible-reset.css';
```
- 由于默认语言改为英文,如果你需要显示中文,现在需要配置 `LocalProvider`
```javascript
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
```javascript
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
ReactDOM.render(
<LocaleProvider locale={zhCN}><YourApp /></LocaleProvider>,
document.getElementById('root')
);
```
ReactDOM.render(
<LocaleProvider locale={zhCN}><YourApp /></LocaleProvider>,
document.getElementById('root')
);
```
- Form 下的表单控件不再默认为 size="large"。
@ -120,24 +120,24 @@ ReactDOM.render(
- 🌟 新增 `focusOnOpen`,用于设置在打开面板的时候是否聚焦输入框。
- Table
- 🌟 新增 `components` 属性,用于覆盖表格元素的默认标签。
```javascript
// 支持覆盖的元素
const components = {
table: MyTable,
header: {
wrapper: HeaderWrapper,
row: HeaderRow,
cell: HeaderCell,
},
body: {
wrapper: BodyWrapper,
row: BodyRow,
cell: BodyCell,
},
};
```javascript
// 支持覆盖的元素
const components = {
table: MyTable,
header: {
wrapper: HeaderWrapper,
row: HeaderRow,
cell: HeaderCell,
},
body: {
wrapper: BodyWrapper,
row: BodyRow,
cell: BodyCell,
},
};
<Table components={components} columns={columns data={data}} />
```
<Table components={components} columns={columns data={data}} />
```
- 🌟 新增 `onRow` 属性,用于设置表格列的属性。
- 🌟 新增 `onHeaderRow`,用户设置表格头部列的属性。
- 🌟 新增 `column[onCell]`,用户设置单元格的属性。
@ -147,15 +147,15 @@ ReactDOM.render(
- 🌟 新增 `rowSelection[fixed]`,用于固定选择列。
- 🙅 废弃 `getBodyWrapper`,请使用 `components` 属性代替。
- 🙅 废弃以下属性 `onRowClick`,`onRowDoubleClick`、`onRowContextMenu`、`onRowMouseEnter`、`onRowMouseLeave`,请使用 `onRow` 代替。
```javascript
<Table onRow={(record) => ({
onClick: () => {},
onDoubleClick: () => {},
onContextMenu: () => {},
onMouseEnter: () => {},
onMouseLeave: () => {},
})} />
```
```javascript
<Table onRow={(record) => ({
onClick: () => {},
onDoubleClick: () => {},
onContextMenu: () => {},
onMouseEnter: () => {},
onMouseLeave: () => {},
})} />
```
- Select
- 🌟 默认和多选模式下 Option 的值允许使用 number。
- 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用与设置最多可显示的选中项。

Loading…
Cancel
Save