diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 217dc2ba66..2e0551a1e6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -43,8 +43,10 @@ Please makes sure that these form are filled before submitting your pull request Describe changes from userside, and list all potential break changes or other risks. ---> -- English Changelog: -- Chinese Changelog (optional): +| Language | Changelog | +| ---------- | --------- | +| 🇺🇸 English | | +| 🇨🇳 Chinese | | ### ☑️ Self Check before Merge diff --git a/.github/PULL_REQUEST_TEMPLATE/pr_cn.md b/.github/PULL_REQUEST_TEMPLATE/pr_cn.md index 86630f71bb..697e91882f 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pr_cn.md +++ b/.github/PULL_REQUEST_TEMPLATE/pr_cn.md @@ -43,7 +43,10 @@ > 从用户角度描述具体变化,以及可能的 breaking change 和其他风险? --> -- 英文: +| 语言 | 更新描述 | +| ------- | -------- | +| 🇺🇸 英文 | | +| 🇨🇳 中文 | | - 中文(可选): diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index f2cab1e935..e39bd90fb2 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,23 @@ timeline: true --- +## 3.18.2 + +`2019-05-20` + +- 🐞 Fix space missing for Button with mixed content. [#15342](https://github.com/ant-design/ant-design/issues/15342) +- 🐞 Fix active status missing for Carousel when `children` is changed. [#16583](https://github.com/ant-design/ant-design/issues/16583) +- 🐞 Fix panel not close when DatePicker is `blur` by upgrading `rc-calendar` requirement to version `9.13.3`. [#16588](https://github.com/ant-design/ant-design/issues/16588) +- 🐞 Fix style disorder for Form.Item with `help` prop and `margin-bottom` is negative. [#16584](https://github.com/ant-design/ant-design/pull/16584) [@sbusch](https://github.com/sbusch) +- 🐞 Fix Spin not align when set `font-size` style. [#15206](https://github.com/ant-design/ant-design/issues/15206) +- 🐞 Fix `selectedRows` missing when there is `childrenColumnName` in Table. [#16614](https://github.com/ant-design/ant-design/issues/16614) +- TypeScript + - ⚡️ Improve the definition of `children` prop for Breadcrumb. [#16550](https://github.com/ant-design/ant-design/pull/16550) [@Gin-X](https://github.com/Gin-X) + - ⚡️ Improve the definition of `onFieldsChange` params for Form. [#16577](https://github.com/ant-design/ant-design/pull/16577) [@SylvanasGone](https://github.com/SylvanasGone) + - ⚡️ Improve the definition of `dataSource` and `renderItem` for List. [#16587](https://github.com/ant-design/ant-design/issues/16587) + - ⚡️ Improve the definition of `onDragEnter` params for Tree. [#16638](https://github.com/ant-design/ant-design/pull/16638) [@eruca](https://github.com/eruca) + - ⚡️ Improve the definition of `event` for Tree。[#16624](https://github.com/ant-design/ant-design/pull/16624) [@ztplz](https://github.com/ztplz) + ## 3.18.1 `2019-05-13` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 9b29408b81..bb1958c9eb 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,23 @@ timeline: true --- +## 3.18.2 + +`2019-05-20` + +- 🐞 修复 Button 组件中插入文本时空格丢失的问题。[#15342](https://github.com/ant-design/ant-design/issues/15342) +- 🐞 修复 Carousel 组件的 `children` 数量变化时,面板指示点的选中状态不正常的问题。[#16583](https://github.com/ant-design/ant-design/issues/16583) +- 🐞 升级 `rc-calendar` 依赖到 `9.13.3` 版本,以修复 DatePicker 组件在失去焦点时面板不会关闭的问题。[#16588](https://github.com/ant-design/ant-design/issues/16588) +- 🐞 修复 Form.Item 组件带有 `help` 信息,并且 `margin-bottom` 为负数时,导致之后的元素样式错乱的问题。[#16584](https://github.com/ant-design/ant-design/pull/16584) [@sbusch](https://github.com/sbusch) +- 🐞 修复 Spin 组件在设置 `font-size` 样式时没有水平居中的问题。[#15206](https://github.com/ant-design/ant-design/issues/15206) +- 🐞 修复 Table 组件指定 `childrenColumnName` 时,`selectedRows` 参数为空的问题。[#16614](https://github.com/ant-design/ant-design/issues/16614) +- TypeScript + - ⚡️ 完善 Breadcrumb 中 `children` 属性的定义。[#16550](https://github.com/ant-design/ant-design/pull/16550) [@Gin-X](https://github.com/Gin-X) + - ⚡️ 完善 Form 中 `onFieldsChange` 函数的参数定义。[#16577](https://github.com/ant-design/ant-design/pull/16577) [@SylvanasGone](https://github.com/SylvanasGone) + - ⚡️ 完善 List 中 `dataSource` 和 `renderItem` 属性的定义。[#16587](https://github.com/ant-design/ant-design/issues/16587) + - ⚡️ 完善 Tree 中 `onDragEnter` 函数的参数定义。[#16638](https://github.com/ant-design/ant-design/pull/16638) [@eruca](https://github.com/eruca) + - ⚡️ 完善 Tree 中 event 属性的定义。[#16624](https://github.com/ant-design/ant-design/pull/16624) [@ztplz](https://github.com/ztplz) + ## 3.18.1 `2019-05-13` diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 2748804a4a..3b114a90d9 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -11,7 +11,7 @@ import { Omit } from '../_util/type'; export interface Route { path: string; breadcrumbName: string; - children: Omit[]; + children?: Omit[]; } export interface BreadcrumbProps { diff --git a/components/breadcrumb/index.zh-CN.md b/components/breadcrumb/index.zh-CN.md index edfe7805f6..5726fc8200 100644 --- a/components/breadcrumb/index.zh-CN.md +++ b/components/breadcrumb/index.zh-CN.md @@ -31,7 +31,7 @@ title: Breadcrumb | href | 链接的目的地 | string | - | | separator | 自定义的分隔符 | string\|ReactNode | '/' | | overlay | 下来菜单的内容 | [Menu](/components/menu) \| () => Menu | - | -| onClick | 单击事件 | (e:MouseEventHandler)=>void | - | +| onClick | 单击事件 | (e:MouseEvent)=>void | - | ### routes diff --git a/components/button/__tests__/__snapshots__/index.test.js.snap b/components/button/__tests__/__snapshots__/index.test.js.snap index 463fbb629c..9206286b7d 100644 --- a/components/button/__tests__/__snapshots__/index.test.js.snap +++ b/components/button/__tests__/__snapshots__/index.test.js.snap @@ -211,6 +211,17 @@ exports[`Button should has click wave effect 1`] = ` `; +exports[`Button should merge text if children using variable 1`] = ` + +`; + exports[`Button should not render as link button when href is undefined 1`] = ` , + ); + + expect(wrapper.render()).toMatchSnapshot(); + }); }); diff --git a/components/button/button.tsx b/components/button/button.tsx index b6a94e6068..abbf9ebf0b 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -15,6 +15,29 @@ function isString(str: any) { return typeof str === 'string'; } +function spaceChildren(children: React.ReactNode, needInserted: boolean) { + let isPrevChildPure: boolean = false; + const childList: React.ReactNode[] = []; + React.Children.forEach(children, child => { + const type = typeof child; + const isCurrentChildPure = type === 'string' || type === 'number'; + if (isPrevChildPure && isCurrentChildPure) { + const lastIndex = childList.length - 1; + const lastChild = childList[lastIndex]; + childList[lastIndex] = `${lastChild}${child}`; + } else { + childList.push(child); + } + + isPrevChildPure = isCurrentChildPure; + }); + + // Pass to React.Children.map to auto fill key + return React.Children.map(childList, child => + insertSpace(child as React.ReactChild, needInserted), + ); +} + // Insert one space between two chinese characters automatically. function insertSpace(child: React.ReactChild, needInserted: boolean) { // Check the child if is undefined or null. @@ -243,9 +266,7 @@ class Button extends React.Component { const iconNode = iconType ? : null; const kids = children || children === 0 - ? React.Children.map(children, child => - insertSpace(child as React.ReactChild, this.isNeedInserted() && autoInsertSpace), - ) + ? spaceChildren(children, this.isNeedInserted() && autoInsertSpace) : null; const linkButtonRestProps = omit(rest as AnchorButtonProps, ['htmlType']); diff --git a/components/carousel/__tests__/index.test.js b/components/carousel/__tests__/index.test.js index 8718220d87..c27f0edacb 100644 --- a/components/carousel/__tests__/index.test.js +++ b/components/carousel/__tests__/index.test.js @@ -105,4 +105,13 @@ describe('Carousel', () => { ); warnSpy.mockRestore(); }); + + it('should active when children change', () => { + const wrapper = mount(); + wrapper.setProps({ + children:
, + }); + wrapper.update(); + expect(wrapper.find('.slick-active').length).toBeTruthy(); + }); }); diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index ec13eb540b..da9319616b 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -33,6 +33,7 @@ export interface CarouselProps extends Settings { prefixCls?: string; slickGoTo?: number; dotPosition?: DotPosition; + children?: React.ReactNode; } export default class Carousel extends React.Component { @@ -70,6 +71,12 @@ export default class Carousel extends React.Component { this.innerSlider = this.slick && this.slick.innerSlider; } + componentDidUpdate(prevProps: CarouselProps) { + if (React.Children.count(this.props.children) !== React.Children.count(prevProps.children)) { + this.goTo(0, false); + } + } + componentWillUnmount() { const { autoplay } = this.props; if (autoplay) { diff --git a/components/cascader/style/index.less b/components/cascader/style/index.less index b2f3733602..590c6e92a1 100644 --- a/components/cascader/style/index.less +++ b/components/cascader/style/index.less @@ -195,8 +195,8 @@ &-active:not(&-disabled) { &, &:hover { - font-weight: 600; - background: @background-color-base; + font-weight: @select-item-selected-font-weight; + background-color: @background-color-light; } } &-expand { diff --git a/components/drawer/style/drawer.less b/components/drawer/style/drawer.less index b3d0259f34..228c585165 100644 --- a/components/drawer/style/drawer.less +++ b/components/drawer/style/drawer.less @@ -187,6 +187,8 @@ &-mask { position: fixed; + top: 0; + left: 0; width: 100%; height: 0; background-color: @modal-mask-bg; diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 1175bba25a..b63d318598 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -20,7 +20,7 @@ interface FormCreateOptionMessages { } export interface FormCreateOption { - onFieldsChange?: (props: T, fields: object, allFields: any) => void; + onFieldsChange?: (props: T, fields: any, allFields: any) => void; onValuesChange?: (props: T, changedValues: any, allValues: any) => void; mapPropsToFields?: (props: T) => void; validateMessages?: FormCreateOptionMessages; diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index 6fa0161efc..2ab893647a 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -225,7 +225,7 @@ See more advanced usage at [async-validator](https://github.com/yiminghe/async-v ## Using in TypeScript -```jsx +```tsx import { Form } from 'antd'; import { FormComponentProps } from 'antd/lib/form'; @@ -238,12 +238,9 @@ class UserForm extends React.Component { // ... } -const App = - Form.create < - UserFormProps > - { - // ... - }(UserForm); +const App = Form.create({ + // ... +})(UserForm); ```