diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 2ce0f0afe3..68c63d7c93 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -17,12 +17,10 @@ timeline: true ## 3.7.0 -3.7.0 is a heavy update that brings a lot of exciting changes and new features. +3.7.0 is a heavy update that brings a lot of exciting changes and new features. Here are some highlights ✨: - 🌟 Add drawer component : [Drawer](https://ant.design/components/drawer-cn/). [#10791](https://github.com/ant-design/ant-design/pull/10791) -- 🌟 Horizontal menu automatically collapses when there is no enough space. [#11234](https://github.com/ant-design/ant-design/pull/11234) -![demo](https://user-images.githubusercontent.com/1731837/42550555-0fef7878-8505-11e8-9d2f-f708fec66b44.gif) - 🌟 Add `Tree.DirectoryTree` component as the built-in directory tree. [#7749](https://github.com/ant-design/ant-design/issues/7749) Component Fixes / Enhancements: @@ -33,8 +31,8 @@ Component Fixes / Enhancements: - 🌟 Add `maxTagCount` prop to set the max count of visible tags. [fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626) - 🌟 Add `maxTagPlaceholder` prop to set the content when the tag is hidden. [fb96c9d](https://github.com/ant-design/ant-design/commit/fb96c9db351e44a202f64f780470c6319a8a9626) - 🌟 Search input now supports case sensitive search. [#10990](https://github.com/ant-design/ant-design/issues/10990) - - 🗑 Remove `label` prop and use `title` prop instead in the `treeData`. -- Upgrade `rc-upload` to `2.5.0` for Upload. + - 🗑 Remove `label` prop and use `title` prop instead in the `treeData`. +- Upgrade `rc-upload` to `2.5.0` for Upload. - 🌟 Add `directory` prop to support folder uploading. [#7315](https://github.com/ant-design/ant-design/issues/7315) - 🌟 `action` prop supports to be the a function which returns a Promise object. [fd96967](https://github.com/ant-design/ant-design/commit/fd96967c872600b79bb608e9ddf9f8c38814a704) - Dropdown diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 3225245c23..08febf5a36 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -17,12 +17,10 @@ timeline: true ## 3.7.0 -3.7.0是一个重磅更新,带来了很多激动人心的变化和新特性。 +3.7.0是一个重磅更新,带来了很多激动人心的变化和新特性。 以下是一些亮点✨: - 🔥 增加抽屉组件 : [`Drawer`](https://ant.design/components/drawer-cn/) [#10791](https://github.com/ant-design/ant-design/pull/10791) -- 🔥 Menu 增加一个横向菜单在空间不足时溢出部分自动收起的特性。[#11234](https://github.com/ant-design/ant-design/pull/11234) -![demo](https://user-images.githubusercontent.com/1731837/42550555-0fef7878-8505-11e8-9d2f-f708fec66b44.gif) - 🔥 新增 `Tree.DirectoryTree` 组件,作为内置的目录树。[#7749](https://github.com/ant-design/ant-design/issues/7749) 组件修复/功能增强: @@ -64,7 +62,7 @@ timeline: true - 🌟 增加 `okButtonDisabled` and `cancelButtonDisabled` 属性用于禁用确定和取消按钮。[#10955](https://github.com/ant-design/ant-design/pull/10955) - 🌟 Cascader 新增 fieldNames 并废弃拼写错误的 filedNames。 [#10896](https://github.com/ant-design/ant-design/issues/10896) - 🐞 修复时间轴不能与`Tooltip`一起使用的问题。 [0e3b67e](https://github.com/ant-design/ant-design/commit/0e3b67e9999d867cc304f3be61a8a042a2ab92ee) -- 🐞 修复当 Avata 自定义大小时,圆角不改变的问题。[e1e6523](https://github.com/ant-design/ant-design/commit/e1e6523452286ba56f20b73abad762a58ea7d7bc) +- 🐞 修复当 Avatar 自定义大小时,圆角不改变的问题。[e1e6523](https://github.com/ant-design/ant-design/commit/e1e6523452286ba56f20b73abad762a58ea7d7bc) ## 3.6.6 diff --git a/README-zh_CN.md b/README-zh_CN.md index 0bbaff3dcc..b2378fd16b 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -34,6 +34,10 @@ * 支持服务端渲染。 * [Electron](http://electron.atom.io/) +| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | [Electron](http://godban.github.io/browsers-support-badges/)
Electron | +| --------- | --------- | --------- | --------- | --------- | --------- | +| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions + ## 参与共建 [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 请参考[贡献指南](https://ant.design/docs/react/contributing-cn). @@ -94,7 +98,7 @@ $ npm install $ npm start ``` -打开浏览器访问 http://127.0.0.1:8001 ,更多本地开发文档参见: https://github.com/ant-design/ant-design/wiki/Development 。 +打开浏览器访问 http://127.0.0.1:8001 ,更多[本地开发文档](https://github.com/ant-design/ant-design/wiki/Development)。 ## 如何贡献 diff --git a/README.md b/README.md index a848bb518b..702338a73e 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ An enterprise-class UI design language and React-based implementation. * Server-side Rendering * [Electron](http://electron.atom.io/) +| [IE / Edge](http://godban.github.io/browsers-support-badges/)
IE / Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | [Opera](http://godban.github.io/browsers-support-badges/)
Opera | [Electron](http://godban.github.io/browsers-support-badges/)
Electron | +| --------- | --------- | --------- | --------- | --------- | --------- | +| IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions + ## Let's build a better antd together [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) Read our [contributing guide](https://ant.design/docs/react/contributing). @@ -67,7 +71,6 @@ Or [import components on demand](https://ant.design/docs/react/getting-started#I See [Use in TypeScript](https://ant.design/docs/react/use-in-typescript) - ## Internationalization See [i18n](http://ant.design/docs/react/i18n). @@ -98,7 +101,7 @@ $ npm install $ npm start ``` -Open your browser and visit http://127.0.0.1:8001 , see more at https://github.com/ant-design/ant-design/wiki/Development . +Open your browser and visit http://127.0.0.1:8001 , see more at [Development](https://github.com/ant-design/ant-design/wiki/Development). ## Contributing diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index bae40b381e..194ebb8d89 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -27,6 +27,14 @@ export default class AnchorLink extends React.Component { this.context.antAnchor.registerLink(this.props.href); } + componentWillReceiveProps(nextProps: AnchorLinkProps) { + const { href } = nextProps; + if (this.props.href !== href) { + this.context.antAnchor.unregisterLink(this.props.href); + this.context.antAnchor.registerLink(href); + } + } + componentWillUnmount() { this.context.antAnchor.unregisterLink(this.props.href); } diff --git a/components/anchor/__tests__/Anchor.test.js b/components/anchor/__tests__/Anchor.test.js index 23fd8ebeba..2fe66a76f0 100644 --- a/components/anchor/__tests__/Anchor.test.js +++ b/components/anchor/__tests__/Anchor.test.js @@ -90,4 +90,20 @@ describe('Anchor Render', () => { wrapper.setProps({ children: null }); expect(wrapper.instance().links).toEqual([]); }); + + it('should update links when link href update', async () => { + let anchorInstance = null; + function AnchorUpdate({ href }) { + return ( + anchorInstance = c}> + + + ); + } + const wrapper = mount(); + + expect(anchorInstance.links).toEqual(['#API']); + wrapper.setProps({ href: '#API_1' }); + expect(anchorInstance.links).toEqual(['#API_1']); + }); }); diff --git a/components/auto-complete/index.zh-CN.md b/components/auto-complete/index.zh-CN.md index fde510fd63..c11370c851 100644 --- a/components/auto-complete/index.zh-CN.md +++ b/components/auto-complete/index.zh-CN.md @@ -34,9 +34,9 @@ const dataSource = ['12345', '23456', '34567']; | optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` | | placeholder | 输入框提示 | string | - | | value | 指定当前选中的条目 | string\|string\[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | 无 | -| onBlur | 获取焦点时的回调 | function() | - | +| onBlur | 失去焦点时的回调 | function() | - | | onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 | -| onFocus | 失去焦点时的回调 | function() | - | +| onFocus | 获得焦点时的回调 | function() | - | | onSearch | 搜索补全项的时候调用 | function(value) | 无 | | onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 | diff --git a/components/card/index.tsx b/components/card/index.tsx index 342d8a1b8f..759f81ccdb 100644 --- a/components/card/index.tsx +++ b/components/card/index.tsx @@ -19,6 +19,7 @@ export type CardType = 'inner'; export interface CardTabListType { key: string; tab: React.ReactNode; + disabled?: boolean; } export interface CardProps extends Omit, 'title'> { @@ -225,7 +226,7 @@ export default class Card extends React.Component { size="large" onChange={this.onTabChange} > - {tabList.map(item => )} + {tabList.map(item => )} ) : null; if (title || extra || tabs) { diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index 111fe4bee9..50e78ea797 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -1,6 +1,7 @@ /* tslint:disable jsx-no-multiline-js */ import * as React from 'react'; import * as moment from 'moment'; +import { polyfill } from 'react-lifecycles-compat'; import RangeCalendar from 'rc-calendar/lib/RangeCalendar'; import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; @@ -63,13 +64,31 @@ function fixLocale(value: RangePickerValue | undefined, localeCode: string) { } } -export default class RangePicker extends React.Component { +class RangePicker extends React.Component { static defaultProps = { prefixCls: 'ant-calendar', allowClear: true, showToday: false, }; + static getDerivedStateFromProps(nextProps: any, prevState: any) { + let state = null; + if ('value' in nextProps) { + const value = nextProps.value || []; + state = { + value, + showDate: getShowDateFromValue(value) || prevState.showDate, + }; + } + if (('open' in nextProps) && prevState.open !== nextProps.open) { + state = { + ...state, + open: nextProps.open, + }; + } + return state; + } + private picker: HTMLSpanElement; constructor(props: any) { @@ -93,22 +112,6 @@ export default class RangePicker extends React.Component }; } - componentWillReceiveProps(nextProps: any) { - if ('value' in nextProps) { - const state = this.state; - const value = nextProps.value || []; - this.setState({ - value, - showDate: getShowDateFromValue(value) || state.showDate, - }); - } - if ('open' in nextProps) { - this.setState({ - open: nextProps.open, - }); - } - } - clearSelection = (e: React.MouseEvent) => { e.preventDefault(); e.stopPropagation(); @@ -366,3 +369,7 @@ export default class RangePicker extends React.Component ); } } + +polyfill(RangePicker); + +export default RangePicker; diff --git a/components/date-picker/WeekPicker.tsx b/components/date-picker/WeekPicker.tsx index cd28a5c612..1d8a5063cb 100644 --- a/components/date-picker/WeekPicker.tsx +++ b/components/date-picker/WeekPicker.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import * as moment from 'moment'; +import { polyfill } from 'react-lifecycles-compat'; import Calendar from 'rc-calendar'; import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; @@ -10,12 +11,19 @@ function formatValue(value: moment.Moment | null, format: string): string { return (value && value.format(format)) || ''; } -export default class WeekPicker extends React.Component { +class WeekPicker extends React.Component { static defaultProps = { format: 'gggg-wo', allowClear: true, }; + static getDerivedStateFromProps(nextProps: any) { + if ('value' in nextProps) { + return { value: nextProps.value }; + } + return null; + } + private input: any; constructor(props: any) { @@ -31,11 +39,6 @@ export default class WeekPicker extends React.Component { value, }; } - componentWillReceiveProps(nextProps: any) { - if ('value' in nextProps) { - this.setState({ value: nextProps.value }); - } - } weekDateRender = (current: any) => { const selectedValue = this.state.value; const { prefixCls } = this.props; @@ -149,3 +152,7 @@ export default class WeekPicker extends React.Component { ); } } + +polyfill(WeekPicker); + +export default WeekPicker; diff --git a/components/date-picker/createPicker.tsx b/components/date-picker/createPicker.tsx index 512e66017f..65dc230d38 100644 --- a/components/date-picker/createPicker.tsx +++ b/components/date-picker/createPicker.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import * as moment from 'moment'; +import { polyfill } from 'react-lifecycles-compat'; import MonthCalendar from 'rc-calendar/lib/MonthCalendar'; import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; @@ -15,13 +16,22 @@ export interface PickerProps { } export default function createPicker(TheCalendar: React.ComponentClass): any { - return class CalenderWrapper extends React.Component { + class CalenderWrapper extends React.Component { static defaultProps = { prefixCls: 'ant-calendar', allowClear: true, showToday: true, }; + static getDerivedStateFromProps(nextProps: PickerProps) { + if ('value' in nextProps) { + return { + value: nextProps.value, + showDate: nextProps.value, + }; + } + } + private input: any; constructor(props: any) { @@ -39,15 +49,6 @@ export default function createPicker(TheCalendar: React.ComponentClass): any { }; } - componentWillReceiveProps(nextProps: PickerProps) { - if ('value' in nextProps) { - this.setState({ - value: nextProps.value, - showDate: nextProps.value, - }); - } - } - renderFooter = (...args: any[]) => { const { prefixCls, renderExtraFooter } = this.props; return renderExtraFooter ? ( @@ -195,5 +196,7 @@ export default function createPicker(TheCalendar: React.ComponentClass): any { ); } - }; + } + polyfill(CalenderWrapper); + return CalenderWrapper; } diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index 4db4a5ba28..e088a31372 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -81,7 +81,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke | format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" | | renderExtraFooter | render extra footer in panel | () => React.ReactNode | - | | showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | -| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() | +| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() | | showToday | whether to show "Today" button | boolean | true | | value | to set date | [moment](http://momentjs.com/) | - | | onCalendarChange | a callback function, can be executed when the start time or the end time of the range is changing | function(dates: [moment, moment], dateStrings: [string, string]) | 无 | @@ -118,7 +118,7 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker, WeekPicke | ranges | preseted ranges for quick selection | { \[range: string]: [moment](http://momentjs.com/)\[] } \| () => { \[range: string]: [moment](http://momentjs.com/)\[] } | - | | renderExtraFooter | render extra footer in panel | () => React.ReactNode | - | | showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | -| showTime.defaultValue | to set default time of selected date, [demo](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] | +| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] | | value | to set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | | onChange | a callback function, can be executed when the selected time is changing | function(dates: [moment, moment], dateStrings: [string, string]) | - | | onOk | callback when click ok button | function() | - | diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md index 2ef766bbff..406476cb53 100644 --- a/components/date-picker/index.zh-CN.md +++ b/components/date-picker/index.zh-CN.md @@ -81,7 +81,7 @@ import 'moment/locale/zh-cn'; | mode | 日期面板的状态 | `time|date|month|year` | 'date' | | renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | | showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) | -| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() | +| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() | | showToday | 是否展示“今天”按钮 | boolean | true | | value | 日期 | [moment](http://momentjs.com/) | 无 | | onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 | @@ -118,7 +118,7 @@ import 'moment/locale/zh-cn'; | ranges       | 预设时间范围快捷选择 | { \[range: string]: [moment](http://momentjs.com/)\[] } \| () => { \[range: string]: [moment](http://momentjs.com/)\[] } | 无 | | renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | | showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) | -| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](https://ant.design/components/date-picker/#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] | +| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | [moment(), moment()] | | value | 日期 | [moment](http://momentjs.com/)\[] | 无 | | onCalendarChange | 待选日期发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 | | onChange | 日期范围发生变化的回调 | function(dates: [moment, moment], dateStrings: [string, string]) | 无 | diff --git a/components/divider/style/index.less b/components/divider/style/index.less index 7368bdc592..926865feac 100644 --- a/components/divider/style/index.less +++ b/components/divider/style/index.less @@ -50,7 +50,6 @@ &-horizontal&-with-text-left, &-horizontal&-with-text-right { - font-size: @font-size-base; .@{divider-prefix-cls}-inner-text { display: inline-block; padding: 0 10px; diff --git a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap index 55313d63ff..8f6efe4616 100644 --- a/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/Drawer.test.js.snap @@ -1,9 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Drawer closable is false 1`] = ` -
+
@@ -33,9 +31,7 @@ exports[`Drawer closable is false 1`] = ` `; exports[`Drawer destroyOnClose is true 1`] = ` -
+
@@ -48,16 +44,18 @@ exports[`Drawer destroyOnClose is true 1`] = ` >
+ > +
+
`; exports[`Drawer have a title 1`] = ` -
+
@@ -104,9 +102,7 @@ exports[`Drawer have a title 1`] = ` `; exports[`Drawer render correctly 1`] = ` -
+
diff --git a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap index 245a1573bb..28619cbcb7 100644 --- a/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap +++ b/components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap @@ -10,9 +10,7 @@ exports[`Drawer render correctly 1`] = ` open -
+
diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 85599a834b..798cf9f65c 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -108,8 +108,16 @@ export default class Drawer extends React.Component { } renderBody = () => { const { destroyOnClose, visible, width, placement } = this.props; + let containerStyle: React.CSSProperties = { width }; + if (placement === 'left' || placement === 'right') { + containerStyle = { + overflow: 'auto', + height: '100%', + width, + }; + } if (destroyOnClose && !visible) { - return null; + return
; } const { prefixCls, title, closable } = this.props; let header; @@ -132,14 +140,7 @@ export default class Drawer extends React.Component { ); } - let containerStyle: React.CSSProperties = { width }; - if (placement === 'left' || placement === 'right') { - containerStyle = { - overflow: 'auto', - height: '100%', - width, - }; - } + return (
{header} @@ -172,6 +173,7 @@ export default class Drawer extends React.Component { showMask={this.props.mask} placement={placement} style={RcDrawerStyle} + class={this.props.wrapClassName} > {this.renderBody()} diff --git a/components/drawer/style/drawer.less b/components/drawer/style/drawer.less index d21b5489e7..d6b6794dcc 100644 --- a/components/drawer/style/drawer.less +++ b/components/drawer/style/drawer.less @@ -8,7 +8,7 @@ width: 100%; height: 100%; pointer-events: none; - z-index: 99999; + z-index: @zindex-modal; transition: transform .3s @ease-in-out-circ; >* { transition: transform .3s @ease-in-out-circ; diff --git a/components/layout/index.zh-CN.md b/components/layout/index.zh-CN.md index ac2890f08b..dc5f7adf43 100644 --- a/components/layout/index.zh-CN.md +++ b/components/layout/index.zh-CN.md @@ -100,7 +100,6 @@ title: Layout | trigger | 自定义 trigger,设置为 null 时隐藏 trigger | string\|ReactNode | - | | width | 宽度 | number\|string | 200 | | onCollapse | 展开-收起时的回调函数,有点击 trigger 以及响应式反馈两种方式可以触发 | (collapsed, type) => {} | - | -| theme | 主题颜色 | string: `light` `dark` | `dark` | | onBreakpoint | 触发响应式布局[断点](/components/grid#api)时的回调 | (broken) => {} | - | #### breakpoint width diff --git a/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap index 4727466b3c..467981f100 100644 --- a/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap +++ b/components/locale-provider/__tests__/__snapshots__/demo.test.js.snap @@ -362,25 +362,8 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = ` class="ant-transfer-list-search-action" > - - + class="anticon anticon-search" + />
@@ -403,21 +386,8 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -1570,27 +1510,9 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter menu" + />
- - + class="anticon anticon-search" + />
@@ -5778,21 +5761,8 @@ exports[`Locale Provider should display the text as ar 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -6935,27 +6875,9 @@ exports[`Locale Provider should display the text as ar 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="الفلاتر" + />
- - + class="anticon anticon-search" + />
@@ -10453,21 +10358,8 @@ exports[`Locale Provider should display the text as bg 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -11610,27 +11472,9 @@ exports[`Locale Provider should display the text as bg 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Филтриране" + />
- - + class="anticon anticon-search" + />
@@ -15128,21 +14955,8 @@ exports[`Locale Provider should display the text as ca 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -16285,27 +16069,9 @@ exports[`Locale Provider should display the text as ca 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtrar Menu" + />
- - + class="anticon anticon-search" + />
@@ -19803,21 +19552,8 @@ exports[`Locale Provider should display the text as cs 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -20960,27 +20666,9 @@ exports[`Locale Provider should display the text as cs 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtr" + />
- - + class="anticon anticon-search" + />
@@ -24478,21 +24149,8 @@ exports[`Locale Provider should display the text as de 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -25635,27 +25263,9 @@ exports[`Locale Provider should display the text as de 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter-Menü" + />
- - + class="anticon anticon-search" + />
@@ -29153,21 +28746,8 @@ exports[`Locale Provider should display the text as el 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -30310,27 +29860,9 @@ exports[`Locale Provider should display the text as el 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Μενού φίλτρων" + />
- - + class="anticon anticon-search" + />
@@ -33828,21 +33343,8 @@ exports[`Locale Provider should display the text as en 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -34985,27 +34457,9 @@ exports[`Locale Provider should display the text as en 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter menu" + />
- - + class="anticon anticon-search" + />
@@ -38503,21 +37940,8 @@ exports[`Locale Provider should display the text as en-gb 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -39660,27 +39054,9 @@ exports[`Locale Provider should display the text as en-gb 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter menu" + />
- - + class="anticon anticon-search" + />
@@ -43178,21 +42537,8 @@ exports[`Locale Provider should display the text as es 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -44335,27 +43651,9 @@ exports[`Locale Provider should display the text as es 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtrar menú" + />
- - + class="anticon anticon-search" + />
@@ -47853,21 +47134,8 @@ exports[`Locale Provider should display the text as et 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -49010,27 +48248,9 @@ exports[`Locale Provider should display the text as et 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtri menüü" + />
- - + class="anticon anticon-search" + />
@@ -52528,21 +51731,8 @@ exports[`Locale Provider should display the text as fa 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -53685,27 +52845,9 @@ exports[`Locale Provider should display the text as fa 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="منوی فیلتر" + />
- - + class="anticon anticon-search" + />
@@ -57203,21 +56328,8 @@ exports[`Locale Provider should display the text as fi 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -58360,27 +57442,9 @@ exports[`Locale Provider should display the text as fi 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Suodatus valikko" + />
- - + class="anticon anticon-search" + />
@@ -61878,21 +60925,8 @@ exports[`Locale Provider should display the text as fr 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -63035,27 +62039,9 @@ exports[`Locale Provider should display the text as fr 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtrer" + />
- - + class="anticon anticon-search" + />
@@ -66553,21 +65522,8 @@ exports[`Locale Provider should display the text as fr 2`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -67710,27 +66636,9 @@ exports[`Locale Provider should display the text as fr 2`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtrer" + />
- - + class="anticon anticon-search" + />
@@ -71228,21 +70119,8 @@ exports[`Locale Provider should display the text as is 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -72385,27 +71233,9 @@ exports[`Locale Provider should display the text as is 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Afmarkanir" + />
- - + class="anticon anticon-search" + />
@@ -75903,21 +74716,8 @@ exports[`Locale Provider should display the text as it 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -77060,27 +75830,9 @@ exports[`Locale Provider should display the text as it 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Menu Filtro" + />
- - + class="anticon anticon-search" + />
@@ -80578,21 +79313,8 @@ exports[`Locale Provider should display the text as ja 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -81735,27 +80427,9 @@ exports[`Locale Provider should display the text as ja 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="メニューをフィルター" + />
- - + class="anticon anticon-search" + />
@@ -85253,21 +83910,8 @@ exports[`Locale Provider should display the text as ko 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -86410,27 +85024,9 @@ exports[`Locale Provider should display the text as ko 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="필터 메뉴" + />
- - + class="anticon anticon-search" + />
@@ -89928,21 +88507,8 @@ exports[`Locale Provider should display the text as ku-iq 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -91085,27 +89621,9 @@ exports[`Locale Provider should display the text as ku-iq 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Menuê peldanka" + />
- - + class="anticon anticon-search" + />
@@ -94603,21 +93104,8 @@ exports[`Locale Provider should display the text as nb 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -95760,27 +94218,9 @@ exports[`Locale Provider should display the text as nb 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtermeny" + />
- - + class="anticon anticon-search" + />
@@ -99278,21 +97701,8 @@ exports[`Locale Provider should display the text as nl 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -100435,27 +98815,9 @@ exports[`Locale Provider should display the text as nl 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filteren" + />
- - + class="anticon anticon-search" + />
@@ -103953,21 +102298,8 @@ exports[`Locale Provider should display the text as nl-be 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -105110,27 +103412,9 @@ exports[`Locale Provider should display the text as nl-be 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="FilterMenu" + />
- - + class="anticon anticon-search" + />
@@ -108628,21 +106895,8 @@ exports[`Locale Provider should display the text as pl 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -109785,27 +108009,9 @@ exports[`Locale Provider should display the text as pl 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Menu filtra" + />
- - + class="anticon anticon-search" + />
@@ -113303,21 +111492,8 @@ exports[`Locale Provider should display the text as pt 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -114460,27 +112606,9 @@ exports[`Locale Provider should display the text as pt 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtro" + />
- - + class="anticon anticon-search" + />
@@ -117978,21 +116089,8 @@ exports[`Locale Provider should display the text as pt-br 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -119135,27 +117203,9 @@ exports[`Locale Provider should display the text as pt-br 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtro" + />
- - + class="anticon anticon-search" + />
@@ -122653,21 +120686,8 @@ exports[`Locale Provider should display the text as ru 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -123810,27 +121800,9 @@ exports[`Locale Provider should display the text as ru 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Фильтр" + />
- - + class="anticon anticon-search" + />
@@ -127328,21 +125283,8 @@ exports[`Locale Provider should display the text as sk 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -128485,27 +126397,9 @@ exports[`Locale Provider should display the text as sk 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter" + />
- - + class="anticon anticon-search" + />
@@ -132003,21 +129880,8 @@ exports[`Locale Provider should display the text as sl 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -133160,27 +130994,9 @@ exports[`Locale Provider should display the text as sl 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter" + />
- - + class="anticon anticon-search" + />
@@ -136678,21 +134477,8 @@ exports[`Locale Provider should display the text as sr 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -137835,27 +135591,9 @@ exports[`Locale Provider should display the text as sr 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filter" + />
- - + class="anticon anticon-search" + />
@@ -141353,21 +139074,8 @@ exports[`Locale Provider should display the text as sv 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -142510,27 +140188,9 @@ exports[`Locale Provider should display the text as sv 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Filtermeny" + />
- - + class="anticon anticon-search" + />
@@ -146028,21 +143671,8 @@ exports[`Locale Provider should display the text as th 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -147185,27 +144785,9 @@ exports[`Locale Provider should display the text as th 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="ตัวกรอง" + />
- - + class="anticon anticon-search" + />
@@ -150703,21 +148268,8 @@ exports[`Locale Provider should display the text as tr 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -151860,27 +149382,9 @@ exports[`Locale Provider should display the text as tr 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Menü Filtrele" + />
- - + class="anticon anticon-search" + />
@@ -155378,21 +152865,8 @@ exports[`Locale Provider should display the text as uk 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -156535,27 +153979,9 @@ exports[`Locale Provider should display the text as uk 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Фільтрувати" + />
- - + class="anticon anticon-search" + />
@@ -160053,21 +157462,8 @@ exports[`Locale Provider should display the text as vi 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -161210,27 +158576,9 @@ exports[`Locale Provider should display the text as vi 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="Bộ " + />
- - + class="anticon anticon-search" + />
@@ -164728,21 +162059,8 @@ exports[`Locale Provider should display the text as zh-cn 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -165885,27 +163173,9 @@ exports[`Locale Provider should display the text as zh-cn 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="筛选" + />
- - + class="anticon anticon-search" + />
@@ -169403,21 +166656,8 @@ exports[`Locale Provider should display the text as zh-tw 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -170560,27 +167770,9 @@ exports[`Locale Provider should display the text as zh-tw 1`] = ` Name - - + class="anticon anticon-filter ant-dropdown-trigger" + title="篩選器" + /> - + diff --git a/components/menu/__tests__/index.test.js b/components/menu/__tests__/index.test.js index e937f0a6da..a2ea7fcfb6 100644 --- a/components/menu/__tests__/index.test.js +++ b/components/menu/__tests__/index.test.js @@ -85,7 +85,6 @@ describe('Menu', () => { wrapper.update(); expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).toBe(true); wrapper.setProps({ openKeys: ['1'] }); - wrapper.update(); expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).not.toBe(true); }); @@ -104,7 +103,6 @@ describe('Menu', () => { wrapper.update(); expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).toBe(true); wrapper.setProps({ openKeys: ['1'] }); - wrapper.update(); expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).not.toBe(true); }); @@ -123,7 +121,6 @@ describe('Menu', () => { wrapper.update(); expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).toBe(true); wrapper.setProps({ openKeys: ['1'] }); - wrapper.update(); expect(wrapper.find('.ant-menu-sub').hostNodes().at(0).hasClass('ant-menu-hidden')).not.toBe(true); }); diff --git a/components/menu/demo/horizontal.md b/components/menu/demo/horizontal.md index 0d9aaf29b0..2082204b24 100755 --- a/components/menu/demo/horizontal.md +++ b/components/menu/demo/horizontal.md @@ -44,7 +44,7 @@ class App extends React.Component { Navigation Two - Navigation Three - Submenu}> + Navigation Three - Submenu}> Option 1 Option 2 diff --git a/components/menu/style/dark.less b/components/menu/style/dark.less index 51084c2232..127e6843d8 100644 --- a/components/menu/style/dark.less +++ b/components/menu/style/dark.less @@ -24,13 +24,14 @@ } &-dark&-horizontal { - border-bottom-color: @menu-dark-bg; + border-bottom: 0; } &-dark&-horizontal > &-item, &-dark&-horizontal > &-submenu { border-color: @menu-dark-bg; border-bottom: 0; + top: 0; } &-dark&-horizontal > &-item > a:before { diff --git a/components/menu/style/index.less b/components/menu/style/index.less index 6d3c4b2129..1b3c004300 100644 --- a/components/menu/style/index.less +++ b/components/menu/style/index.less @@ -179,10 +179,6 @@ position: absolute; border-radius: @border-radius-base; z-index: @zindex-dropdown; - - .submenu-title-wrapper { - padding-right: 20px; - } } > .@{menu-prefix-cls} { @@ -266,13 +262,12 @@ border-bottom: @border-width-base @border-style-base @border-color-split; box-shadow: none; line-height: 46px; - white-space: nowrap; > .@{menu-prefix-cls}-item, > .@{menu-prefix-cls}-submenu { position: relative; top: 1px; - display: inline-block; + float: left; border-bottom: 2px solid transparent; &:hover, diff --git a/components/message/style/index.less b/components/message/style/index.less index a5209d262e..bef367345f 100644 --- a/components/message/style/index.less +++ b/components/message/style/index.less @@ -21,7 +21,7 @@ } &-notice-content { - padding: 10px 16px; + padding: @message-notice-content-padding; border-radius: @border-radius-base; box-shadow: @shadow-2; background: @component-background; diff --git a/components/notification/index.en-US.md b/components/notification/index.en-US.md index 3b9af9239e..149b8f0d6e 100644 --- a/components/notification/index.en-US.md +++ b/components/notification/index.en-US.md @@ -24,6 +24,7 @@ used in the following cases: - `notification.info(config)` - `notification.warning(config)` - `notification.warn(config)` +- `notification.open(config)` - `notification.close(key: String)` - `notification.destroy()` diff --git a/components/notification/index.zh-CN.md b/components/notification/index.zh-CN.md index 1b79dd3c42..f377eb16f8 100644 --- a/components/notification/index.zh-CN.md +++ b/components/notification/index.zh-CN.md @@ -23,6 +23,7 @@ subtitle: 通知提醒框 - `notification.info(config)` - `notification.warning(config)` - `notification.warn(config)` +- `notification.open(config)` - `notification.close(key: String)` - `notification.destroy()` diff --git a/components/select/__tests__/__snapshots__/demo.test.js.snap b/components/select/__tests__/__snapshots__/demo.test.js.snap index 707d590f23..e2c5fce7bd 100644 --- a/components/select/__tests__/__snapshots__/demo.test.js.snap +++ b/components/select/__tests__/__snapshots__/demo.test.js.snap @@ -407,16 +407,11 @@ exports[`renders ./components/select/demo/search-box.md correctly 1`] = ` > -
@@ -108,23 +91,10 @@ exports[`renders ./components/transfer/demo/advanced.md correctly 1`] = ` type="button" > - - + class="anticon anticon-right" + /> - to left + to right @@ -203,25 +160,8 @@ exports[`renders ./components/transfer/demo/advanced.md correctly 1`] = ` class="ant-transfer-list-search-action" > - - + class="anticon anticon-search" + /> @@ -368,21 +308,8 @@ exports[`renders ./components/transfer/demo/basic.md correctly 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-right" + />
- - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
@@ -868,21 +713,8 @@ exports[`renders ./components/transfer/demo/search.md correctly 1`] = ` type="button" > - - + class="anticon anticon-right" + />
- - + class="anticon anticon-search" + />
diff --git a/components/transfer/__tests__/__snapshots__/index.test.js.snap b/components/transfer/__tests__/__snapshots__/index.test.js.snap index 0b9237f5df..fbaa3e8bb1 100644 --- a/components/transfer/__tests__/__snapshots__/index.test.js.snap +++ b/components/transfer/__tests__/__snapshots__/index.test.js.snap @@ -96,48 +96,22 @@ exports[`Transfer should render correctly 1`] = `
+ -
- - + class="anticon anticon-right" + />
{ it('should move selected keys to corresponding list', () => { const handleChange = jest.fn(); const wrapper = mount(); - wrapper.find(TransferOperation).find(Button).at(1).simulate('click'); // move selected keys to right list + wrapper.find(TransferOperation).find(Button).at(0).simulate('click'); // move selected keys to right list expect(handleChange).toHaveBeenCalledWith(['a', 'b'], 'right', ['a']); }); it('should move selected keys expect disabled to corresponding list', () => { const handleChange = jest.fn(); const wrapper = mount(); - wrapper.find(TransferOperation).find(Button).at(1).simulate('click'); // move selected keys to right list + wrapper.find(TransferOperation).find(Button).at(0).simulate('click'); // move selected keys to right list expect(handleChange).toHaveBeenCalledWith(['b'], 'right', ['b']); }); @@ -209,7 +209,7 @@ describe('Transfer', () => { .simulate('change', { target: { value: 'content2' } }); wrapper.find(TransferList).at(0).find('.ant-transfer-list-header input[type="checkbox"]').filterWhere(n => !n.prop('checked')) .simulate('change'); - wrapper.find(TransferOperation).find(Button).at(1).simulate('click'); + wrapper.find(TransferOperation).find(Button).at(0).simulate('click'); expect(handleChange).toHaveBeenCalledWith(['1', '3', '4'], 'right', ['1']); }); diff --git a/components/transfer/operation.tsx b/components/transfer/operation.tsx index c0acbcbcf0..21f19551d2 100644 --- a/components/transfer/operation.tsx +++ b/components/transfer/operation.tsx @@ -26,15 +26,6 @@ export default class Operation extends React.Component - +
); } diff --git a/components/tree/DirectoryTree.tsx b/components/tree/DirectoryTree.tsx index 63883094ab..80210e4b3c 100644 --- a/components/tree/DirectoryTree.tsx +++ b/components/tree/DirectoryTree.tsx @@ -158,6 +158,7 @@ export default class DirectoryTree extends React.Component, node: AntTreeNode) => { const { expandedKeys = [] } = this.state; + const { onExpand } = this.props; const { eventKey = '', expanded, isLeaf } = node.props; if (isLeaf || event.shiftKey || event.metaKey || event.ctrlKey) { @@ -176,6 +177,14 @@ export default class DirectoryTree extends React.Component { diff --git a/components/tree/__tests__/__snapshots__/directory.test.js.snap b/components/tree/__tests__/__snapshots__/directory.test.js.snap index 8e0c43372f..6883968189 100644 --- a/components/tree/__tests__/__snapshots__/directory.test.js.snap +++ b/components/tree/__tests__/__snapshots__/directory.test.js.snap @@ -1104,6 +1104,132 @@ exports[`Directory Tree expand double click 2`] = ` `; +exports[`Directory Tree expand with state control click 1`] = ` +
    +
  • + + + + + + + parent + + +
      +
    • + + + + + + + children + + +
    • +
    +
  • +
+`; + +exports[`Directory Tree expand with state control doubleClick 1`] = ` +
    +
  • + + + + + + + parent + + +
      +
    • + + + + + + + children + + +
    • +
    +
  • +
+`; + exports[`Directory Tree expandedKeys update 1`] = `
    { wrapper.find(TreeNode).find('.ant-tree-node-content-wrapper').at(0).simulate('doubleClick'); expect(wrapper.render()).toMatchSnapshot(); }); + + describe('with state control', () => { + class StateDirTree extends React.Component { + state = { + expandedKeys: [], + }; + + onExpand = (expandedKeys) => { + this.setState({ expandedKeys }); + }; + + render() { + const { expandedKeys } = this.state; + + return ( + + + + + + ); + } + } + + ['click', 'doubleClick'].forEach((action) => { + it(action, () => { + const wrapper = mount( + + ); + + wrapper.find(TreeNode).find('.ant-tree-node-content-wrapper').at(0).simulate(action); + jest.runAllTimers(); + expect(wrapper.render()).toMatchSnapshot(); + }); + }); + }); }); it('defaultExpandAll', () => { diff --git a/docs/spec/values.en-US.md b/docs/spec/values.en-US.md index 0d3e6296ef..f33b7db64d 100644 --- a/docs/spec/values.en-US.md +++ b/docs/spec/values.en-US.md @@ -4,7 +4,7 @@ order: 1 title: Design Values --- -Ant Design provides a practical evaluation of better design for both designers of Ant Design and designers who are using it. At the same time, it build a foundation for design principles and design patterns which could provide guideline and general solutions for specified design goal. +Ant Design provides a practical evaluation of better design for both designers of Ant Design and designers who are using it. At the same time, it builds a foundation for design principles and design patterns which could provide guideline and general solutions for specified design goal.
    diff --git a/docs/spec/visual.md b/docs/spec/visual.md index 68924cb26f..903bc26e95 100644 --- a/docs/spec/visual.md +++ b/docs/spec/visual.md @@ -7,7 +7,7 @@ title: 可视化语言是基于中台设计语言 Ant Design 衍生的一套具有数据可视化特性的设计指导原则,让数据表达更符合用户心理,帮助『设计者』孵化出更具业务特性的可视化解决方案以满足个性化设计需求,屏蔽不必要的设计差异和实现成本,从而解放『设计者』和前端的研发资源,实现全面提高数据图表的研发效率。 -同时,这是一份动态更新的设计文档,你的阅读和反馈正是我们不断前进的动力,[Github 反馈地址](https://github.com/antvis/site/issues)。 +同时,这是一份动态更新的设计文档,你的阅读和反馈正是我们不断前进的动力,[GitHub 反馈地址](https://github.com/antvis/site/issues)。 ## 设计资源 diff --git a/package.json b/package.json index 00ead64487..f6da000c3d 100644 --- a/package.json +++ b/package.json @@ -61,12 +61,12 @@ "rc-checkbox": "~2.1.5", "rc-collapse": "~1.9.0", "rc-dialog": "~7.1.0", - "rc-drawer": "~1.5.3", + "rc-drawer": "~1.5.9", "rc-dropdown": "~2.2.0", "rc-editor-mention": "^1.0.2", "rc-form": "^2.1.0", "rc-input-number": "~4.0.0", - "rc-menu": "~7.2.2", + "rc-menu": "~7.0.2", "rc-notification": "~3.1.1", "rc-pagination": "~1.16.1", "rc-progress": "~2.2.2", @@ -85,7 +85,7 @@ "rc-upload": "~2.5.0", "rc-util": "^4.0.4", "react-lazy-load": "^3.0.12", - "react-lifecycles-compat": "^3.0.4", + "react-lifecycles-compat": "^3.0.2", "react-slick": "~0.23.1", "shallowequal": "^1.0.1", "warning": "~4.0.1" @@ -94,6 +94,7 @@ "@babel/types": "7.0.0-beta.44", "@types/react": "^16.0.0", "@types/react-dom": "^16.0.0", + "@yesmeck/offline-plugin": "^5.0.5", "ansi-styles": "^3.2.0", "ant-design-palettes": "^1.0.0", "antd-theme-generator": "1.0.7", @@ -142,7 +143,6 @@ "majo": "^0.6.2", "mockdate": "^2.0.1", "moment-timezone": "^0.5.5", - "offline-plugin": "yesmeck/offline-plugin#fix-cache-key", "pre-commit": "^1.2.2", "preact": "^8.2.5", "preact-compat": "^3.17.0", diff --git a/site/bisheng.config.js b/site/bisheng.config.js index 4d7bcaf3cd..673294c572 100644 --- a/site/bisheng.config.js +++ b/site/bisheng.config.js @@ -1,6 +1,6 @@ const path = require('path'); const CSSSplitWebpackPlugin = require('css-split-webpack-plugin').default; -const OfflinePlugin = require('offline-plugin'); +const OfflinePlugin = require('@yesmeck/offline-plugin'); const replaceLib = require('antd-tools/lib/replaceLib'); const getExternalResources = require('./getExternalResources'); diff --git a/site/theme/template/Layout/index.jsx b/site/theme/template/Layout/index.jsx index b34d91d40b..e3e19ec7b1 100644 --- a/site/theme/template/Layout/index.jsx +++ b/site/theme/template/Layout/index.jsx @@ -6,7 +6,7 @@ import { addLocaleData, IntlProvider } from 'react-intl'; import 'moment/locale/zh-cn'; import { LocaleProvider } from 'antd'; import zhCN from 'antd/lib/locale-provider/zh_CN'; -import OfflineRuntime from 'offline-plugin/runtime'; +import OfflineRuntime from '@yesmeck/offline-plugin/runtime'; import Header from './Header'; import Footer from './Footer'; import enLocale from '../../en-US';