CHANGELOG.zh-CN.md 9.7 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

A
afc163 已提交
16 17
---

W
Wei Zhu 已提交
18
## 3.0.0
A
afc163 已提交
19

W
Wei Zhu 已提交
20
`2017-12-04`
W
Wei Zhu 已提交
21

W
Wei Zhu 已提交
22 23
更多内容见 [Ant Design 3.0 发布公告](https://medium.com/ant-design/announcing-ant-design-3-0-70e3e65eca0c)

W
Wei Zhu 已提交
24
### 主要变化
偏右 已提交
25

A
afc163 已提交
26
- 全新的[色彩系统](https://ant.design/docs/spec/colors-cn#Color-Palettes),组件主色由 『`#108EE9`』 改为 『`#1890FF`』,新主色我们称之为『拂晓蓝』。
W
Wei Zhu 已提交
27 28 29 30 31 32 33 34
- 全新的视觉样式和组件尺寸,更现代更美观。
- 基础字体大小由 `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/)
35

W
Wei Zhu 已提交
36
### 不兼容改动
37

W
Wei Zhu 已提交
38 39 40 41
- 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 已提交
42

W
Wei Zhu 已提交
43 44 45 46 47 48 49 50 51 52 53 54
  ```diff
  import { Form } from 'antd';

  Form.create({
    mapPropsToFields() {
      return {
  -     name: { value: 'antd' },
  +     name: Form.createFormField({ value: 'antd' }),
      };
    },
  })
  ```
D
ddcat1115 已提交
55

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

W
Wei Zhu 已提交
58
  ```javascript
W
Wei Zhu 已提交
59
  import 'antd/lib/style/v2-compatible-reset';
W
Wei Zhu 已提交
60
  ```
W
Wei Zhu 已提交
61

W
Wei Zhu 已提交
62
  或者在 less 里引入
W
Wei Zhu 已提交
63

W
Wei Zhu 已提交
64
  ```less
A
afc163 已提交
65
  @import '~antd/lib/style/v2-compatible-reset.less';
W
Wei Zhu 已提交
66
  ```
W
Wei Zhu 已提交
67

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

W
Wei Zhu 已提交
70 71 72
  ```javascript
  import { LocaleProvider } from 'antd';
  import zhCN from 'antd/lib/locale-provider/zh_CN';
偏右 已提交
73

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

W
Wei Zhu 已提交
80
- Form 下的表单控件不再默认为 size="large"。
W
Wei Zhu 已提交
81
- UMD 版本的  `dist/antd.js` 不再包含 moment,使用的时候需要自己引入 moment。
W
Wei Zhu 已提交
82 83 84 85 86 87 88 89
  ```diff
  <html>
    <head>
  +   <script src="https://unpkg.com/moment@2.19.3/moment.js"></script>
      <script src="https://unpkg.com/antd@3.0.0/dist/antd.js"></script>
    </head>
  </html>
  ```
90

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

W
Wei Zhu 已提交
93 94 95 96 97 98
- 🗑 移除了 DatePicker.Calendar, 请直接使用 Calendar 组件。
- 🗑 移除了 DatePicker 的 `toggleOpen` 属性, 请使用 `onOpenChange` 代替。
- 🗑 移除了 Form 的 `inline``horizontal``vertical` 属性,请使用 `layout` 代替。
- 🗑 移除了 Select 的 `multiple``tags``combobox` 属性,请使用 `mode` 代替。
- 🗑 移除了 Input 对 `type='textarea'` 的支持,请直接使用 `Input.TextArea` 组件。
- 🗑 移除了 Mention 的 `toEditorState` 方法,请使用 `toContentState` 代替。
99

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

W
Wei Zhu 已提交
102 103 104 105 106 107 108 109 110 111 112 113
- 🌟 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 已提交
114
- Form
W
Wei Zhu 已提交
115 116 117 118 119 120 121
  - 🌟 新增显示验证信息时的动画效果。
  - 🌟 新增按条件渲染表单项的支持。[#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)
乐仪 已提交
122
- Card
W
Wei Zhu 已提交
123 124
  - 🌟 新增 `inner` 类型。[例子](https://ant.design/components/card-cn/#components-card-demo-inner)
  - 🌟 新增 `cover``actions` 以及 `Meta` 子组件。[例子](https://ant.design/components/card-cn/#components-card-demo-meta)
乐仪 已提交
125
- DatePicker
W
Wei Zhu 已提交
126 127 128 129 130 131
  - 🌟 新增 `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`,用于设置在打开面板的时候是否聚焦输入框。
乐仪 已提交
132
- Table
W
Wei Zhu 已提交
133
  - 🌟 新增 `components` 属性,用于覆盖表格元素的默认标签。
W
Wei Zhu 已提交
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
    ```javascript
    // 支持覆盖的元素
    const components = {
      table: MyTable,
      header: {
        wrapper: HeaderWrapper,
        row: HeaderRow,
        cell: HeaderCell,
      },
      body: {
        wrapper: BodyWrapper,
        row: BodyRow,
        cell: BodyCell,
      },
    };
W
Wei Zhu 已提交
149

W
Wei Zhu 已提交
150 151
    <Table components={components} columns={columns data={data}}  />
    ```
W
Wei Zhu 已提交
152 153 154 155 156 157 158 159 160
  - 🌟 新增 `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` 代替。
W
Wei Zhu 已提交
161 162 163 164 165 166 167 168 169
    ```javascript
    <Table onRow={(record) => ({
      onClick: () => {},
      onDoubleClick: () => {},
      onContextMenu: () => {},
      onMouseEnter: () => {},
      onMouseLeave: () => {},
    })} />
    ```
A
afc163 已提交
170
- Select
W
Wei Zhu 已提交
171 172 173 174
  - 🌟 默认和多选模式下 Option 的值允许使用 number。
  - 🌟 新增 `maxTagCount 和 `maxTagPlaceholder`,用与设置最多可显示的选中项。
  - 🌟 新增 `showAction`,用于设置出发下拉框打开的事件。
  - 🌟 新增 `onMouseEnter` 和 `onMouseLeave` 事件回调。
175
- LocaleProvider
W
Wei Zhu 已提交
176 177 178
  - 🇮🇸 新增冰岛语。[#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)
乐仪 已提交
179

W
Wei Zhu 已提交
180
### Bug 修复
W
Wei Zhu 已提交
181 182

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

W
Wei Zhu 已提交
187
### 其他
188

W
Wei Zhu 已提交
189 190 191
- 在 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 的优化效果。
W
Wei Zhu 已提交
192
- 最后,我们会继续维护 2.x 的分支到明年 6 月份。
193

W
Wei Zhu 已提交
194
## 2.x
A
afc163 已提交
195

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

B
Benjy Cui 已提交
198
## 1.11.4
B
Benjy Cui 已提交
199

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