CHANGELOG.zh-CN.md 9.1 KB
Newer Older
B
Benjy Cui 已提交
1
---
A
afc163 已提交
2
order: 6
A
afc163 已提交
3
title: 更新日志
A
afc163 已提交
4 5 6 7
toc: false
timeline: true
---

A
afc163 已提交
8 9
`antd` 严格遵循 [Semantic Versioning 2.0.0](http://semver.org/lang/zh-CN/) 语义化版本规范。

10 11
#### 发布周期

A
afc163 已提交
12 13 14
* 修订版本号:每周末会进行日常 bugfix 更新。(如果有紧急的 bugfix,则任何时候都可发布)
* 次版本号:每月发布一个带有新特性的向下兼容的版本。
* 主版本号:含有破坏性更新和新特性,不在发布周期内。
15

W
Wei Zhu 已提交
16
## 3.0.0
A
afc163 已提交
17

W
Wei Zhu 已提交
18
`2017-12-04`
W
Wei Zhu 已提交
19

W
Wei Zhu 已提交
20
### 主要变化
偏右 已提交
21

W
Wei Zhu 已提交
22 23 24 25 26 27 28 29 30
- 全新的[色彩系统](https://ant.design/docs/spec/colors-cn#Color-Palettes), 组件主色由 『`#108EE9`』 改为 『`#1890FF`』,新主色我们称之为“拂晓蓝”。
- 全新的视觉样式和组件尺寸,更现代更美观。
- 基础字体大小由 `12px` 增大到 `14px`
- 默认语言由中文改为英文。
- 全面支持 React 16。
- 更友好的 TypeScript 支持。
- 新的 [List](https://ant.design/components/list-cn/) 组件。
- 新的 [Divider](https://ant.design/components/divider-cn/) 组件。
- 新增 30 个[图标](https://ant.design/components/icon-cn/)
31

W
Wei Zhu 已提交
32
### 不兼容改动
33

W
Wei Zhu 已提交
34 35 36 37
- Card 的 `noHovering` 属性重命名为 `hoverable`,且默认值改为 `true`
- 调整了 Grid 的响应式断点值。详见 [#7230](https://github.com/ant-design/ant-design/pull/7230)
- Form `getFieldDecorator``exclusive` 参数被移除,此类场景应该由 Radio.Group、Checkbox.Group 之类的组件来完成。
- 新增 `Form.createFormField` 方法,`mapPropsToFields` 返回的字段都需要由该方法创建。
N
nikogu 已提交
38

W
Wei Zhu 已提交
39 40
```diff
import { Form } from 'antd';
N
nikogu 已提交
41

W
Wei Zhu 已提交
42 43 44 45 46 47 48 49 50
Form.create({
  mapPropsToFields() {
    return {
-     name: { value: 'antd' },
+     name: Form.createFormField({ value: 'antd' }),
    };
  },
})
```
D
ddcat1115 已提交
51

W
Wei Zhu 已提交
52
- 优化了全局的重置样式,如果升级后你的全局样式有问题,可以引入我们提供的 2.x 兼容样式。
D
ddcat1115 已提交
53

W
Wei Zhu 已提交
54 55 56
```javascript
import 'antd/style/v2-compatible-reset';
```
W
Wei Zhu 已提交
57

W
Wei Zhu 已提交
58
或者在 less 里引入
W
Wei Zhu 已提交
59

W
Wei Zhu 已提交
60 61 62
```less
@import '~antd/style/v2-compatible-reset.css';
```
W
Wei Zhu 已提交
63

W
Wei Zhu 已提交
64
- 由于默认语言改为英文,如果你需要显示中文,现在需要配置 `LocalProvider`
偏右 已提交
65

W
Wei Zhu 已提交
66 67 68
```javascript
import { LocaleProvider } from 'antd';
import zhCN from 'antd/lib/locale-provider/zh_CN';
偏右 已提交
69

W
Wei Zhu 已提交
70 71 72 73 74
ReactDOM.render(
  <LocaleProvider locale={zhCN}><YourApp /></LocaleProvider>,
  document.getElementById('root')
);
```
偏右 已提交
75

W
Wei Zhu 已提交
76
- Form 下的表单控件不再默认为 size="large"。
77

W
Wei Zhu 已提交
78
### 以下在 2.x 中废弃的特性被移除
79

W
Wei Zhu 已提交
80 81 82 83 84 85
- 🗑 移除了 DatePicker.Calendar, 请直接使用 Calendar 组件。
- 🗑 移除了 DatePicker 的 `toggleOpen` 属性, 请使用 `onOpenChange` 代替。
- 🗑 移除了 Form 的 `inline``horizontal``vertical` 属性,请使用 `layout` 代替。
- 🗑 移除了 Select 的 `multiple``tags``combobox` 属性,请使用 `mode` 代替。
- 🗑 移除了 Input 对 `type='textarea'` 的支持,请直接使用 `Input.TextArea` 组件。
- 🗑 移除了 Mention 的 `toEditorState` 方法,请使用 `toContentState` 代替。
86

W
Wei Zhu 已提交
87
### 新增功能及改进
N
nikogu 已提交
88

W
Wei Zhu 已提交
89 90 91 92 93 94 95 96 97 98 99 100
- 🌟 Tabs 新增 `size="large"`
- 🌟 Row 的 `gutter` 属性新增响应式断点的支持,可以使用诸如 `gutter={{ sm: 16, lg: 32 }}` 的设置。
- 🌟 Spin 新增 `indicator` 属性,用于设置自定义的加载指示符。 [#7977](https://github.com/ant-design/ant-design/pull/7977) [@kossel](https://github.com/ant-design/ant-design/pull/7977)
- 🌟 Input.Search 新增 `enterButton` 用于设置自定义的搜索图标。[#7596](https://github.com/ant-design/ant-design/issues/7596)
- 🌟 Mention 新增 `placement`, 用于设置下拉框的弹出方向。
- 🌟 Carousel 新增 `next()``prev()``goTo(slideNumber)` 方法,用于控制面板展示。
- 🌟 Button 新增链接支持,当提供 `href` 时会自动渲染为 `<a>`[#8343](https://github.com/ant-design/ant-design/pull/8343)
- 🌟 Steps 进行了重构,首次渲染的时候不会再闪烁。 [#6010](https://github.com/ant-design/ant-design/issues/6010)
- 🌟 Switch 新增 `loading` 属性,用于表现加载中的状态。
- Menu
  - 🌟 新增 `subMenuOpenDelay``subMenuCloseDelay`,用于设置子菜单打开和关闭的延迟。
  - 🌟 新增 `forceSubMenuRender`,用于强制渲染子菜单。[#5586](https://github.com/ant-design/ant-design/issues/5586)
N
nikogu 已提交
101
- Form
W
Wei Zhu 已提交
102 103 104 105 106 107 108
  - 🌟 新增显示验证信息时的动画效果。
  - 🌟 新增按条件渲染表单项的支持。[#react-component/117](https://github.com/react-component/form/issues/117)
- Message
  - 🌟 `duration` 允许可选 [#7857](https://github.com/ant-design/ant-design/issues/7857) [@monkindey](https://github.com/monkindey)
- Badge
  - 🌟 新增 `offset` 属性,用于设置状态点的位置偏移。
  - 🌟 `status` 允许与 `children` 同时使用。[#8164](https://github.com/ant-design/ant-design/issues/8164)
乐仪 已提交
109
- Card
W
Wei Zhu 已提交
110 111
  - 🌟 新增 `inner` 类型。[例子](https://ant.design/components/card-cn/#components-card-demo-inner)
  - 🌟 新增 `cover``actions` 以及 `Meta` 子组件。[例子](https://ant.design/components/card-cn/#components-card-demo-meta)
乐仪 已提交
112
- DatePicker
W
Wei Zhu 已提交
113 114 115 116 117 118
  - 🌟 新增 `mode``onPanelChange`,用户控制面板的展示模式。[例子](https://ant.design/components/date-picker-cn/#components-date-picker-demo-mode)
  - 🌟 新增 `WeekPicker` 子组件。[例子](https://ant.design/components/date-picker-cn/#components-date-picker-demo-basic)
  - 🌟 新增 `dateRender` 属性,用于自定义日期单元格的渲染。
- TimePicker
  - 🌟 新增 `hourStep``minuteStep``secondStep`,用于设置时间步长。[例子](https://ant.design/components/time-picker-cn/#components-time-picker-demo-interval-options)
  - 🌟 新增 `focusOnOpen`,用于设置在打开面板的时候是否聚焦输入框。
乐仪 已提交
119
- Table
W
Wei Zhu 已提交
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
  - 🌟 新增 `components` 属性,用于覆盖表格元素的默认标签。
  ```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}}  />
  ```
  - 🌟 新增 `onRow` 属性,用于设置表格列的属性。
  - 🌟 新增 `onHeaderRow`,用户设置表格头部列的属性。
  - 🌟 新增 `column[onCell]`,用户设置单元格的属性。
  - 🌟 新增 `column[onHeaderCell]`,用于设置头部单元格的属性。
  - 🌟 新增 `column[align]`,用于设置列内文字的对其方向。
  - 🌟 新增 `column[defaultSortOrder]`,用于设置列的默认排序。[#8111](https://github.com/ant-design/ant-design/pull/8111) [@megawac](https://github.com/megawac)
  - 🌟 新增 `rowSelection[fixed]`,用于固定选择列。
  - 🙅 废弃 `getBodyWrapper`,请使用 `components` 属性代替。
  - 🙅 废弃以下属性 `onRowClick``onRowDoubleClick``onRowContextMenu``onRowMouseEnter``onRowMouseLeave`,请使用 `onRow` 代替。
  ```javascript
  <Table onRow={(record) => ({
    onClick: () => {},
    onDoubleClick: () => {},
    onContextMenu: () => {},
    onMouseEnter: () => {},
    onMouseLeave: () => {},
  })} />
  ```
A
afc163 已提交
157
- Select
W
Wei Zhu 已提交
158 159 160 161
  - 🌟 默认和多选模式下 Option 的值允许使用 number。
  - 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用与设置最多可显示的选中项。
  - 🌟 新增 `showAction`,用于设置出发下拉框打开的事件。
  - 🌟 新增 `onMouseEnter` 和 `onMouseLeave` 事件回调。
162
- LocaleProvider
W
Wei Zhu 已提交
163 164 165
  - 🇮🇸 新增冰岛语。[#7561](https://github.com/ant-design/ant-design/pull/7561) [@paunovic-stefan](https://github.com/paunovic-stefan)
  - 🇪🇬 新增埃及语。[#7888](https://github.com/ant-design/ant-design/pull/7888) [@mohamed-seada-1994](https://github.com/mohamed-seada-1994)
  - 🇺🇦 新增乌克兰语。[#8169](https://github.com/ant-design/ant-design/pull/8169) [@anxolerd](https://github.com/anxolerd)
乐仪 已提交
166

W
Wei Zhu 已提交
167
### Bug 修复
W
Wei Zhu 已提交
168 169

- Form
W
Wei Zhu 已提交
170 171 172
  - 🐞 修复输入框的图标会被验证图标覆盖的问题。
  - 🐞 修复使用大尺寸输入框时,验证图标不居中的问题。
- 🐞 修复 Menu 按键时的报错。[#8089](https://github.com/ant-design/ant-design/issues/8089)
R
RaoHai 已提交
173

W
Wei Zhu 已提交
174
### 其他变动
175

W
Wei Zhu 已提交
176 177 178
- 在 TypeScript 中使用时不再需要设置 `allowSyntheticDefaultImports`。
- 从 `peerDependencies` 中移除了 `react@0.14` 和 `react@15`,虽然目前 antd 3.0.0 依然可以在旧版本的 React 上使用,但是我们在未来有可能使用 React 16 的新特性,所以强烈建议升级到 React 16,见[升级文档](https://reactjs.org/blog/2017/09/26/react-v16.0.html)。
- 全面支持 ES Module ,antd 及其依赖的底层 react-component 组件全部提供了 ES Module 的构建版本,如果你使用 webpack 3,可以把 `babel-import-plugin` 的 `libraryDirectory` 设置为 `es`,以获得 Tree Shaking 的优化效果。
179

W
Wei Zhu 已提交
180
## 2.x
A
afc163 已提交
181

W
Wei Zhu 已提交
182
去 [GitHub](https://github.com/ant-design/ant-design/blob/2.x-stable/CHANGELOG.md) 查看 `2.x` 的 Change Log。
183

B
Benjy Cui 已提交
184
## 1.11.4
B
Benjy Cui 已提交
185

A
afc163 已提交
186
去 [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md) 查看 `0.x` 到 `1.x` 的 Change Log。