Browse Source

merge feature branch

pull/15890/head
zombiej 6 years ago
parent
commit
be17c03245
  1. 4
      .gitignore
  2. 1
      .npmignore
  3. 43
      CHANGELOG.en-US.md
  4. 42
      CHANGELOG.zh-CN.md
  5. 54
      components/__tests__/util/domHook.js
  6. 2
      components/_util/raf.ts
  7. 2
      components/_util/resizeObserver.tsx
  8. 2
      components/_util/wave.tsx
  9. 26
      components/affix/__tests__/Affix.test.js
  10. 25
      components/affix/index.tsx
  11. 23
      components/alert/__tests__/__snapshots__/demo.test.js.snap
  12. 8
      components/auto-complete/__tests__/__snapshots__/demo.test.js.snap
  13. 12
      components/avatar/__tests__/__snapshots__/demo.test.js.snap
  14. 5
      components/badge/__tests__/__snapshots__/demo.test.js.snap
  15. 2
      components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap
  16. 23
      components/button/__tests__/__snapshots__/demo.test.js.snap
  17. 5
      components/button/__tests__/__snapshots__/index.test.js.snap
  18. 13
      components/button/button.tsx
  19. 8
      components/calendar/__tests__/__snapshots__/demo.test.js.snap
  20. 2
      components/calendar/__tests__/__snapshots__/index.test.js.snap
  21. 10
      components/card/__tests__/__snapshots__/demo.test.js.snap
  22. 15
      components/cascader/__tests__/__snapshots__/demo.test.js.snap
  23. 22
      components/cascader/__tests__/__snapshots__/index.test.js.snap
  24. 22
      components/collapse/__tests__/__snapshots__/demo.test.js.snap
  25. 2
      components/collapse/__tests__/__snapshots__/index.test.js.snap
  26. 2
      components/comment/__tests__/__snapshots__/demo.test.js.snap
  27. 486
      components/config-provider/__tests__/__snapshots__/components.test.js.snap
  28. 2
      components/config-provider/renderEmpty.tsx
  29. 25
      components/date-picker/__tests__/DatePicker.test.js
  30. 3
      components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap
  31. 1
      components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap
  32. 1
      components/date-picker/__tests__/__snapshots__/WeekPicker.test.js.snap
  33. 41
      components/date-picker/__tests__/__snapshots__/demo.test.js.snap
  34. 8
      components/date-picker/__tests__/__snapshots__/other.test.js.snap
  35. 2
      components/date-picker/style/RangePicker.less
  36. 32
      components/date-picker/wrapPicker.tsx
  37. 5
      components/drawer/__tests__/__snapshots__/Drawer.test.js.snap
  38. 1
      components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap
  39. 1
      components/drawer/__tests__/__snapshots__/demo.test.js.snap
  40. 9
      components/dropdown/__tests__/__snapshots__/demo.test.js.snap
  41. 1
      components/dropdown/__tests__/__snapshots__/dropdown-button.test.js.snap
  42. 74
      components/empty/__tests__/__snapshots__/demo.test.js.snap
  43. 2
      components/empty/demo/customize.md
  44. 2
      components/empty/demo/simple.md
  45. 2
      components/empty/empty.svg
  46. 13
      components/empty/index.tsx
  47. 2
      components/empty/simple.svg
  48. 14
      components/empty/style/index.less
  49. 16
      components/form/FormItem.tsx
  50. 60
      components/form/__tests__/__snapshots__/demo.test.js.snap
  51. 8
      components/form/demo/customized-form-controls.md
  52. 2
      components/form/demo/global-state.md
  53. 4
      components/form/index.en-US.md
  54. 4
      components/form/index.zh-CN.md
  55. 4
      components/form/style/index.less
  56. 1
      components/form/style/mixin.less
  57. 12
      components/icon/__tests__/__snapshots__/index.test.js.snap
  58. 4
      components/icon/index.en-US.md
  59. 4
      components/icon/index.zh-CN.md
  60. 16
      components/input-number/__tests__/__snapshots__/demo.test.js.snap
  61. 2
      components/input/__tests__/__snapshots__/Search.test.js.snap
  62. 20
      components/input/__tests__/__snapshots__/demo.test.js.snap
  63. 5
      components/input/__tests__/__snapshots__/index.test.js.snap
  64. 76
      components/layout/Sider.tsx
  65. 28
      components/layout/__tests__/__snapshots__/demo.test.js.snap
  66. 2
      components/layout/__tests__/demo.test.js
  67. 36
      components/layout/__tests__/index.test.js
  68. 125
      components/layout/demo/custom-trigger-debug.md
  69. 51
      components/layout/layout.tsx
  70. 13
      components/list/__tests__/__snapshots__/demo.test.js.snap
  71. 2
      components/list/__tests__/__snapshots__/empty.test.js.snap
  72. 317
      components/list/__tests__/__snapshots__/pagination.test.js.snap
  73. 28
      components/list/__tests__/pagination.test.js
  74. 44
      components/list/index.tsx
  75. 2
      components/list/style/index.less
  76. 77
      components/locale-provider/__tests__/__snapshots__/demo.test.js.snap
  77. 3438
      components/locale-provider/__tests__/__snapshots__/index.test.js.snap
  78. 38
      components/menu/MenuItem.tsx
  79. 18
      components/menu/SubMenu.tsx
  80. 25
      components/menu/__tests__/__snapshots__/demo.test.js.snap
  81. 73
      components/menu/__tests__/__snapshots__/index.test.js.snap
  82. 82
      components/menu/__tests__/index.test.js
  83. 185
      components/menu/index.tsx
  84. 6
      components/menu/style/index.less
  85. 1
      components/menu/style/index.tsx
  86. 2
      components/modal/__tests__/__snapshots__/Modal.test.js.snap
  87. 1
      components/notification/__tests__/__snapshots__/demo.test.js.snap
  88. 4
      components/page-header/__tests__/__snapshots__/demo.test.js.snap
  89. 1
      components/pagination/Pagination.tsx
  90. 29
      components/pagination/__tests__/__snapshots__/demo.test.js.snap
  91. 1
      components/pagination/index.en-US.md
  92. 1
      components/pagination/index.zh-CN.md
  93. 4
      components/popconfirm/__tests__/__snapshots__/index.test.js.snap
  94. 14
      components/progress/__tests__/__snapshots__/demo.test.js.snap
  95. 2
      components/progress/__tests__/__snapshots__/index.test.js.snap
  96. 19
      components/progress/__tests__/index.test.js
  97. 1
      components/progress/demo/gradient-line.md
  98. 26
      components/progress/progress.tsx
  99. 70
      components/rate/__tests__/__snapshots__/demo.test.js.snap
  100. 18
      components/select/__tests__/__snapshots__/demo.test.js.snap

4
.gitignore

@ -35,8 +35,8 @@ yarn.lock
package-lock.json
components/**/*.js
components/**/*.jsx
!components/**/__tests__/*.js
!components/**/__tests__/*.js.snap
!components/**/__tests__/**/*.js
!components/**/__tests__/**/*.js.snap
/.history
# Docs templates
site/theme/template/IconDisplay/*.js

1
.npmignore

@ -0,0 +1 @@
~*

43
CHANGELOG.en-US.md

@ -15,6 +15,47 @@ timeline: true
---
## 3.16.3
`2019-04-12`
- 🐞 **Fix Button TypeScript definition.** [#15938](https://github.com/ant-design/ant-design/pull/15938)
- ⚠️ Add DatePicker warning when time invalidate. [#15920](https://github.com/ant-design/ant-design/pull/15920)
- 🐞 Fix Menu arrow not display in old version of IE. [#15932](https://github.com/ant-design/ant-design/pull/15932)
- 🐞 Fix Progress success UI when `status` is `undefined`. [#15951](https://github.com/ant-design/ant-design/pull/15951)
- 🐞 Fix Tooltips not work when Menu collapsed. [#15948](https://github.com/ant-design/ant-design/pull/15948)
- 🐞 Fix Switch can't be trigger by click of form label. [#15923](https://github.com/ant-design/ant-design/pull/15923)
- 🐞 Fix Directory `onSelect` info not correct. [#15967](https://github.com/ant-design/ant-design/pull/15967)
- 🐞 Fix Menu `defaultOpenKeys` not work as expect. [#15970](https://github.com/ant-design/ant-design/pull/15970)
- 🐞 Fix Nested Table with `middle` `size` style not correct. [#16008](https://github.com/ant-design/ant-design/pull/16008)
- 🐞 Fix nest Tabs ink bar style issue. [#16013](https://github.com/ant-design/ant-design/pull/16013)
- 🐞 Fix Empty in IE not fully render. [#16016](https://github.com/ant-design/ant-design/pull/16016)
- 🐞 Fix Switcher loading icon and checkbox should be vertical align when `@tree-title-height` is modified. [#15962](https://github.com/ant-design/ant-design/pull/15962)
- 💄 Default selection column width can be overrided in css. [#15990](https://github.com/ant-design/ant-design/pull/15990)
- TypeScript
- 🐞 Fix Pagination `showLessItems` TS definition. [#15952](https://github.com/ant-design/ant-design/pull/15952)
## 3.16.2
`2019-04-07`
- 🐞 Fix Menu shaking and collapse behavior. [#15868](https://github.com/ant-design/ant-design/pull/15868)
- 🐞 Fix List pagination pageSize changer not work. [#15871](https://github.com/ant-design/ant-design/pull/15871)
- 🐞 Fix RangePicker end time input not editable. [#15866](https://github.com/ant-design/ant-design/pull/15866)
- 📝 Site [Icon](https://ant.design/components/icon/) supports search. [#15867](https://github.com/ant-design/ant-design/pull/15867) [@DiamondYuan](https://github.com/DiamondYuan)
- 🐞 Fix TimePicker `locale` doesn't work. [#15837](https://github.com/ant-design/ant-design/pull/15837)
- 🐞 Fix Steps style broken when using `progressDot` and `size="small"`. [#15856](https://github.com/ant-design/ant-design/pull/15856)
- 🐞 Fix Affix position not update when content height changed. [#15899](https://github.com/ant-design/ant-design/pull/15899)
- Table
- 🐞 Fix Table `align: right` not work on title when sorting is enabled. [#15895](https://github.com/ant-design/ant-design/pull/15895)
- 🐞 Fix Table filter display issue when use non-string type. [#15817](https://github.com/ant-design/ant-design/pull/15817)
- 🐞 Fix Badge display negative count incorrect. [#15810](https://github.com/ant-design/ant-design/pull/15810)
- 💄 Optimize Empty default UI of `Empty.PRESENTED_IMAGE_SIMPLE`. [#15841](https://github.com/ant-design/ant-design/pull/15841)
- 🌟 Added a new less variable `@html-selector` to enable override of html selector to support theme prefix. [#15613](https://github.com/ant-design/ant-design/pull/15613) [@krokofant](https://github.com/krokofant)
- TypeScript
- 🐞 Fix Table columnGroup definition. [fc45d](https://github.com/ant-design/ant-design/commit/fc45d7003efab225298bbc7ac740df40d34872d1)
## 3.16.1
`2019-04-01`
@ -71,7 +112,7 @@ timeline: true
`2019-03-23`
- 📖 New English translation for [Data Display](https://ant.design/docs/spec/data-display) and [Feedback](https://ant.design/docs/spec/feedback). [#15454](https://github.com/ant-design/ant-design/pull/15454) [@klouskingsley](https://github.com/klouskingsley) [#15460](https://github.com/ant-design/ant-design/pull/15460) [@klouskingsley](https://github.com/klouskingsley)
- 🌟 Add two less variables `@font-feature-settings` and `@select-item-selected-font-weight`. [#15506](https://github.com/ant-design/ant-design/pull/15506) [@dancerphil](https://github.com/dancerphil) [#15515](https://github.com/ant-design/ant-design/pull/15515) [@willc001](https://github.com/willc001)
- 🌟 Add two less variables `@font-feature-settings` and `@select-item-selected-font-weight`. [#15506](https://github.com/ant-design/ant-design/pull/15506) [@dancerphil](https://github.com/dancerphil) [#15515](https://github.com/ant-design/ant-design/pull/15515) [@willc001](https://github.com/willc001)
- 🐞 Fix the scale calculate logic when Avatar is remounted. [#15503](https://github.com/ant-design/ant-design/pull/15503)
- 🐞 Fix inefficient custom `width` for DatePicker. [#15547](https://github.com/ant-design/ant-design/pull/15547) [@DiamondYuan](https://github.com/DiamondYuan)
- 🐞 Fix the incorrect priority of icon style for Notification. [#15530](https://github.com/ant-design/ant-design/pull/15530)

42
CHANGELOG.zh-CN.md

@ -15,6 +15,46 @@ timeline: true
---
## 3.16.3
`2019-04-12`
- 🐞 **修复 Button TS 类型定义。**[#15938](https://github.com/ant-design/ant-design/pull/15938)
- ⚠️ DatePicker 新增当日期不合法的提示。[#15920](https://github.com/ant-design/ant-design/pull/15920)
- 🐞 修复 Menu 箭头在老 IE 版本上不显示的问题。[#15932](https://github.com/ant-design/ant-design/pull/15932)
- 🐞 修复 Progress 当 `status``undefined` 时的展示。[#15951](https://github.com/ant-design/ant-design/pull/15951)
- 🐞 修复 Menu 折叠时 Tooltip 的问题。[#15948](https://github.com/ant-design/ant-design/pull/15948)
- 🐞 修复 Switch 应该被 Label 触发的问题。[#15923](https://github.com/ant-design/ant-design/pull/15923)
- 🐞 修复 Directory `onSelect` 无法使用的问题。[#15967](https://github.com/ant-design/ant-design/pull/15967)
- 🐞 修复 Menu `defaultOpenKeys` 不工作。[#15970](https://github.com/ant-design/ant-design/pull/15970)
- 🐞 修复内嵌的 Table `size``middle` 时的样式。[#16008](https://github.com/ant-design/ant-design/pull/16008)
- 🐞 修复 Tab `display: none` 时高亮线条丢失的问题。[#16013](https://github.com/ant-design/ant-design/pull/16013)
- 🐞 修复 Empty IE 展示的问题。[#16016](https://github.com/ant-design/ant-design/pull/16016)
- 🐞 修复通过修改 `@tree-title-height` 的值会导致 tree-switcher-loading-icon 位置不再居中的问题。[#15962](https://github.com/ant-design/ant-design/pull/15962)
- 💄 修复默认的 selection column width 无法被样式覆盖的问题。[#15990](https://github.com/ant-design/ant-design/pull/15990)
- TypeScript
- 🐞 修复 Pagination `showLessItems` TS 类型定义。[#15952](https://github.com/ant-design/ant-design/pull/15952)
## 3.16.2
`2019-04-07`
- 🐞 修复 Menu 收缩的异常闪动。[#15868](https://github.com/ant-design/ant-design/pull/15868)
- 🐞 修复 List 分页无法改变每页条数。[#15871](https://github.com/ant-design/ant-design/pull/15871)
- 🐞 修复 RangePicker 结束时间不可输入。[#15866](https://github.com/ant-design/ant-design/pull/15866)
- 📝 站点 [Icon](https://ant.design/components/icon-cn/) 支持图标搜索。[#15867](https://github.com/ant-design/ant-design/pull/15867) [@DiamondYuan](https://github.com/DiamondYuan)
- 🐞 修复 TimePicker `locale` 属性无效的问题。 [#15837](https://github.com/ant-design/ant-design/pull/15837)
- 🐞 修复 Steps 同时使用 `progressDot``size="small"` 时的样式错乱问题。[#15856](https://github.com/ant-design/ant-design/pull/15856)
- 🐞 修复 Affix 的内容高度改变时,位置不更新的问题。 [#15899](https://github.com/ant-design/ant-design/pull/15899)
- Table
- 🐞 修复 Table 使用排序时,表头设置 `align: right` 失效的问题。[#15895](https://github.com/ant-design/ant-design/pull/15895)
- 🐞 修复 Table 筛选使用 string 以外类型的展示问题。 [#15817](https://github.com/ant-design/ant-design/pull/15817)
- 🐞 修复 Badge `count` 为负数时的显示问题。[#15810](https://github.com/ant-design/ant-design/pull/15810)
- 💄 优化 `Empty.PRESENTED_IMAGE_SIMPLE` 的默认样式。 [#15841](https://github.com/ant-design/ant-design/pull/15841)
- 🌟 新增 less 变量 `@html-selector` 用于支持主题前缀。[#15613](https://github.com/ant-design/ant-design/pull/15613) [@krokofant](https://github.com/krokofant)
- TypeScript
- 🐞 修复 Table `columnGroup` 定义。[fc45d](https://github.com/ant-design/ant-design/commit/fc45d7003efab225298bbc7ac740df40d34872d1)
## 3.16.1
`2019-04-01`
@ -71,7 +111,7 @@ timeline: true
`2019-03-23`
- 📖 翻译[模式-数据展示](https://ant.design/docs/spec/data-display)和[模式-反馈](https://ant.design/docs/spec/feedback)文档到英文。[#15454](https://github.com/ant-design/ant-design/pull/15454) [@klouskingsley](https://github.com/klouskingsley) [#15460](https://github.com/ant-design/ant-design/pull/15460) [@klouskingsley](https://github.com/klouskingsley)
- 🌟 新增 less 变量 `@font-feature-settings``@select-item-selected-font-weight`。[#15506](https://github.com/ant-design/ant-design/pull/15506) [@dancerphil](https://github.com/dancerphil) [#15515](https://github.com/ant-design/ant-design/pull/15515) [@willc001](https://github.com/willc001)
- 🌟 新增 less 变量 `@font-feature-settings``@select-item-selected-font-weight`。[#15506](https://github.com/ant-design/ant-design/pull/15506) [@dancerphil](https://github.com/dancerphil) [#15515](https://github.com/ant-design/ant-design/pull/15515) [@willc001](https://github.com/willc001)
- 🐞 修复 Avatar 组件在重新挂载后字符大小和长度计算错误的问题。[#15503](https://github.com/ant-design/ant-design/pull/15503)
- 🐞 修复 DatePicker 组件的宽度无法自定义的问题。[#15547](https://github.com/ant-design/ant-design/pull/15547) [@DiamondYuan](https://github.com/DiamondYuan)
- 🐞 修复 Notification 组件的 icon 样式被全局默认样式覆盖的问题。[#15530](https://github.com/ant-design/ant-design/pull/15530)

54
components/__tests__/util/domHook.js

@ -0,0 +1,54 @@
export function spyElementPrototypes(Element, properties) {
const propNames = Object.keys(properties);
const originDescriptors = {};
propNames.forEach(propName => {
const originDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, propName);
originDescriptors[propName] = originDescriptor;
const spyProp = properties[propName];
if (typeof spyProp === 'function') {
// If is a function
Element.prototype[propName] = function spyFunc(...args) {
return spyProp.call(this, originDescriptor, ...args);
};
} else {
// Otherwise tread as a property
Object.defineProperty(Element.prototype, propName, {
...spyProp,
set(value) {
if (spyProp.set) {
return spyProp.set.call(this, originDescriptor, value);
}
return originDescriptor.set(value);
},
get() {
if (spyProp.get) {
return spyProp.get.call(this, originDescriptor);
}
return originDescriptor.get();
},
});
}
});
return {
mockRestore() {
propNames.forEach(propName => {
const originDescriptor = originDescriptors[propName];
if (typeof originDescriptor === 'function') {
Element.prototype[propName] = originDescriptor;
} else {
Object.defineProperty(Element.prototype, propName, originDescriptor);
}
});
},
};
}
export function spyElementPrototype(Element, propName, property) {
return spyElementPrototypes(Element, {
[propName]: property,
});
}

2
components/_util/raf.ts

@ -34,3 +34,5 @@ wrapperRaf.cancel = function(pid?: number) {
raf.cancel(ids[pid]);
delete ids[pid];
};
wrapperRaf.ids = ids; // export this for test usage

2
components/_util/resizeObserver.tsx

@ -53,7 +53,7 @@ class ReactResizeObserver extends React.Component<ResizeObserverProps, {}> {
}
render() {
const { children } = this.props;
const { children = null } = this.props;
return children;
}
}

2
components/_util/wave.tsx

@ -60,7 +60,7 @@ export default class Wave extends React.Component<{ insertExtraNode?: boolean }>
}
extraNode.style.borderColor = waveColor;
styleForPesudo.innerHTML = `[ant-click-animating-without-extra-node="true"]:after { border-color: ${waveColor}; }`;
styleForPesudo.innerHTML = `html body { --antd-wave-shadow-color: ${waveColor}; }`;
if (!document.body.contains(styleForPesudo)) {
document.body.appendChild(styleForPesudo);
}

26
components/affix/__tests__/Affix.test.js

@ -137,4 +137,30 @@ describe('Affix Render', () => {
expect(wrapper.instance().state.affixStyle).toBe(undefined);
expect(wrapper.instance().state.placeholderStyle).toBe(undefined);
});
it('updatePosition when size changed', () => {
document.body.innerHTML = '<div id="mounter" />';
const updateCalled = jest.fn();
wrapper = mount(<AffixMounter offsetBottom={0} onTestUpdatePosition={updateCalled} />, {
attachTo: document.getElementById('mounter'),
});
jest.runAllTimers();
movePlaceholder(300);
expect(wrapper.instance().affix.state.affixStyle).toBeTruthy();
jest.runAllTimers();
wrapper.update();
// Mock trigger resize
updateCalled.mockReset();
wrapper
.find('ReactResizeObserver')
.instance()
.onResize();
jest.runAllTimers();
expect(updateCalled).toHaveBeenCalled();
});
});

25
components/affix/index.tsx

@ -4,6 +4,7 @@ import classNames from 'classnames';
import omit from 'omit.js';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame';
import ResizeObserver from '../_util/resizeObserver';
import warning from '../_util/warning';
import { addObserveTarget, removeObserveTarget, getTargetRect } from './utils';
@ -109,13 +110,21 @@ class Affix extends React.Component<AffixProps, AffixState> {
// Handle realign logic
@throttleByAnimationFrameDecorator()
// @ts-ignore TS6133
updatePosition(e: Event) {
updatePosition(e?: Event) {
// event param is used before. Keep compatible ts define here.
this.setState({
status: AffixStatus.Prepare,
affixStyle: undefined,
placeholderStyle: undefined,
});
// Test if `updatePosition` called
if (process.env.NODE_ENV === 'test') {
const { onTestUpdatePosition } = this.props as any;
if (onTestUpdatePosition) {
onTestUpdatePosition();
}
}
}
measure = () => {
@ -194,13 +203,11 @@ class Affix extends React.Component<AffixProps, AffixState> {
[getPrefixCls('affix', prefixCls)]: affixStyle,
});
const props = omit(this.props, [
'prefixCls',
'offsetTop',
'offsetBottom',
'target',
'onChange',
]);
let props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange']);
// Omit this since `onTestUpdatePosition` only works on test.
if (process.env.NODE_ENV === 'test') {
props = omit(props, ['onTestUpdatePosition']);
}
const mergedPlaceholderStyle = {
...(status === AffixStatus.None ? placeholderStyle : null),
...style,
@ -208,7 +215,7 @@ class Affix extends React.Component<AffixProps, AffixState> {
return (
<div {...props} style={mergedPlaceholderStyle} ref={this.savePlaceholderNode}>
<div className={className} ref={this.saveFixedNode} style={this.state.affixStyle}>
{children}
<ResizeObserver onResize={this.updatePosition}>{children}</ResizeObserver>
</div>
</div>
);

23
components/alert/__tests__/__snapshots__/demo.test.js.snap

@ -15,6 +15,7 @@ exports[`renders ./components/alert/demo/banner.md correctly 1`] = `
class=""
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -47,6 +48,7 @@ exports[`renders ./components/alert/demo/banner.md correctly 1`] = `
class=""
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -76,6 +78,7 @@ exports[`renders ./components/alert/demo/banner.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -115,6 +118,7 @@ exports[`renders ./components/alert/demo/banner.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -178,6 +182,7 @@ exports[`renders ./components/alert/demo/closable.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -215,6 +220,7 @@ exports[`renders ./components/alert/demo/closable.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -278,6 +284,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -309,6 +316,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -340,6 +348,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -371,6 +380,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -402,6 +412,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -435,6 +446,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -468,6 +480,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -501,6 +514,7 @@ exports[`renders ./components/alert/demo/custom-icon.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -604,6 +618,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -635,6 +650,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="info-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -666,6 +682,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -697,6 +714,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -728,6 +746,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -764,6 +783,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="info-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -800,6 +820,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -836,6 +857,7 @@ exports[`renders ./components/alert/demo/icon.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -888,6 +910,7 @@ exports[`renders ./components/alert/demo/smooth-closed.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

8
components/auto-complete/__tests__/__snapshots__/demo.test.js.snap

@ -59,6 +59,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -128,6 +129,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -162,6 +164,7 @@ exports[`renders ./components/auto-complete/demo/certain-category.md correctly 1
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -229,6 +232,7 @@ exports[`renders ./components/auto-complete/demo/custom.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -302,6 +306,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -375,6 +380,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -448,6 +454,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -483,6 +490,7 @@ exports[`renders ./components/auto-complete/demo/uncertain-category.md correctly
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

12
components/avatar/__tests__/__snapshots__/demo.test.js.snap

@ -20,6 +20,7 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -209,6 +210,7 @@ exports[`renders ./components/avatar/demo/badge.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -244,6 +246,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -266,6 +269,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -288,6 +292,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -310,6 +315,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -335,6 +341,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -357,6 +364,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -379,6 +387,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -401,6 +410,7 @@ exports[`renders ./components/avatar/demo/basic.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -528,6 +538,7 @@ exports[`renders ./components/avatar/demo/type.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -586,6 +597,7 @@ exports[`renders ./components/avatar/demo/type.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

5
components/badge/__tests__/__snapshots__/demo.test.js.snap

@ -203,6 +203,7 @@ exports[`renders ./components/badge/demo/basic.md correctly 1`] = `
class=""
data-icon="clock-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -407,6 +408,7 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
class=""
data-icon="minus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -430,6 +432,7 @@ exports[`renders ./components/badge/demo/change.md correctly 1`] = `
class=""
data-icon="plus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -745,6 +748,7 @@ exports[`renders ./components/badge/demo/dot.md correctly 1`] = `
class=""
data-icon="notification"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -771,6 +775,7 @@ exports[`renders ./components/badge/demo/dot.md correctly 1`] = `
class=""
data-icon="notification"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/breadcrumb/__tests__/__snapshots__/demo.test.js.snap

@ -231,6 +231,7 @@ exports[`renders ./components/breadcrumb/demo/withIcon.md correctly 1`] = `
class=""
data-icon="home"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -261,6 +262,7 @@ exports[`renders ./components/breadcrumb/demo/withIcon.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

23
components/button/__tests__/__snapshots__/demo.test.js.snap

@ -177,6 +177,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -206,6 +207,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -233,6 +235,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
class=""
data-icon="cloud"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -256,6 +259,7 @@ exports[`renders ./components/button/demo/button-group.md correctly 1`] = `
class=""
data-icon="cloud-download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -406,6 +410,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -429,6 +434,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -455,6 +461,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -478,6 +485,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -505,6 +513,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -528,6 +537,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -554,6 +564,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -577,6 +588,7 @@ exports[`renders ./components/button/demo/icon.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -608,6 +620,7 @@ exports[`renders ./components/button/demo/loading.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -634,6 +647,7 @@ exports[`renders ./components/button/demo/loading.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -669,6 +683,7 @@ exports[`renders ./components/button/demo/loading.md correctly 1`] = `
class=""
data-icon="poweroff"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -696,6 +711,7 @@ exports[`renders ./components/button/demo/loading.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -719,6 +735,7 @@ exports[`renders ./components/button/demo/loading.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -766,6 +783,7 @@ exports[`renders ./components/button/demo/multiple.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -891,6 +909,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -914,6 +933,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -940,6 +960,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
class=""
data-icon="download"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -970,6 +991,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -999,6 +1021,7 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

5
components/button/__tests__/__snapshots__/index.test.js.snap

@ -52,6 +52,7 @@ exports[`Button renders Chinese characters correctly 2`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -81,6 +82,7 @@ exports[`Button renders Chinese characters correctly 3`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -110,6 +112,7 @@ exports[`Button renders Chinese characters correctly 4`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -139,6 +142,7 @@ exports[`Button renders Chinese characters correctly 5`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -168,6 +172,7 @@ exports[`Button renders Chinese characters correctly 6`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"

13
components/button/button.tsx

@ -62,20 +62,23 @@ export interface BaseButtonProps {
children?: React.ReactNode;
}
// Typescript will make optional not optional if use Pick with union.
// Should change to `AnchorButtonProps | NativeButtonProps` and `any` to `HTMLAnchorElement | HTMLButtonElement` if it fixed.
// ref: https://github.com/ant-design/ant-design/issues/15930
export type AnchorButtonProps = {
href: string;
target?: string;
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
onClick?: React.MouseEventHandler<any>;
} & BaseButtonProps &
Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'type'>;
Omit<React.AnchorHTMLAttributes<any>, 'type'>;
export type NativeButtonProps = {
htmlType?: ButtonHTMLType;
onClick?: React.MouseEventHandler<HTMLButtonElement>;
onClick?: React.MouseEventHandler<any>;
} & BaseButtonProps &
Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>;
Omit<React.ButtonHTMLAttributes<any>, 'type'>;
export type ButtonProps = AnchorButtonProps | NativeButtonProps;
export type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
interface ButtonState {
loading?: boolean | { delay?: number };

8
components/calendar/__tests__/__snapshots__/demo.test.js.snap

@ -45,6 +45,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -95,6 +96,7 @@ exports[`renders ./components/calendar/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1090,6 +1092,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1140,6 +1143,7 @@ exports[`renders ./components/calendar/demo/card.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2133,6 +2137,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2183,6 +2188,7 @@ exports[`renders ./components/calendar/demo/notice-calendar.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3586,6 +3592,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3636,6 +3643,7 @@ exports[`renders ./components/calendar/demo/select.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/calendar/__tests__/__snapshots__/index.test.js.snap

@ -45,6 +45,7 @@ exports[`Calendar Calendar should support locale 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -95,6 +96,7 @@ exports[`Calendar Calendar should support locale 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

10
components/card/__tests__/__snapshots__/demo.test.js.snap

@ -591,6 +591,7 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -615,6 +616,7 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = `
class=""
data-icon="edit"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -639,6 +641,7 @@ exports[`renders ./components/card/demo/loading.md correctly 1`] = `
class=""
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -717,6 +720,7 @@ exports[`renders ./components/card/demo/meta.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -741,6 +745,7 @@ exports[`renders ./components/card/demo/meta.md correctly 1`] = `
class=""
data-icon="edit"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -765,6 +770,7 @@ exports[`renders ./components/card/demo/meta.md correctly 1`] = `
class=""
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -855,6 +861,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -882,6 +889,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1013,6 +1021,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1040,6 +1049,7 @@ exports[`renders ./components/card/demo/tabs.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

15
components/cascader/__tests__/__snapshots__/demo.test.js.snap

@ -26,6 +26,7 @@ exports[`renders ./components/cascader/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -64,6 +65,7 @@ exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] =
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -117,6 +119,7 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -135,6 +138,7 @@ exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -187,6 +191,7 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -205,6 +210,7 @@ exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -243,6 +249,7 @@ exports[`renders ./components/cascader/demo/disabled-option.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -281,6 +288,7 @@ exports[`renders ./components/cascader/demo/fields-name.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -319,6 +327,7 @@ exports[`renders ./components/cascader/demo/hover.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -357,6 +366,7 @@ exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -394,6 +404,7 @@ exports[`renders ./components/cascader/demo/search.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -433,6 +444,7 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -470,6 +482,7 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -507,6 +520,7 @@ exports[`renders ./components/cascader/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -549,6 +563,7 @@ exports[`renders ./components/cascader/demo/suffix.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

22
components/cascader/__tests__/__snapshots__/index.test.js.snap

@ -26,6 +26,7 @@ exports[`Cascader can be selected 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -54,6 +55,7 @@ exports[`Cascader can be selected 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -86,6 +88,7 @@ exports[`Cascader can be selected 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -129,6 +132,7 @@ exports[`Cascader can be selected 2`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -157,6 +161,7 @@ exports[`Cascader can be selected 2`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -189,6 +194,7 @@ exports[`Cascader can be selected 2`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -242,6 +248,7 @@ exports[`Cascader can be selected 3`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -270,6 +277,7 @@ exports[`Cascader can be selected 3`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -302,6 +310,7 @@ exports[`Cascader can be selected 3`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -365,6 +374,7 @@ exports[`Cascader popup correctly when panel is open 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -393,6 +403,7 @@ exports[`Cascader popup correctly when panel is open 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -436,6 +447,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -464,6 +476,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -496,6 +509,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1182,21 +1196,21 @@ exports[`Cascader should render not found content 1`] = `
<Consumer>
<OriginEmpty
className="ant-empty-small"
image="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iN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WxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNUY1RjUiIGN4PSIzMiIgY3k9IjMzIiByeD0iMzIiIHJ5PSI3Ii8+CiAgICA8ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
>
<Consumer>
<LocaleReceiver
componentName="Empty"
>
<div
className="ant-empty ant-empty-small"
className="ant-empty ant-empty-normal ant-empty-small"
>
<div
className="ant-empty-image"
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNU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DxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -1251,6 +1265,7 @@ exports[`Cascader support controlled mode 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1269,6 +1284,7 @@ exports[`Cascader support controlled mode 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

22
components/collapse/__tests__/__snapshots__/demo.test.js.snap

@ -23,6 +23,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -53,6 +54,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -83,6 +85,7 @@ exports[`renders ./components/collapse/demo/accordion.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -120,6 +123,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
style="-ms-transform:rotate(90deg);transform:rotate(90deg)"
viewBox="64 64 896 896"
@ -166,6 +170,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -196,6 +201,7 @@ exports[`renders ./components/collapse/demo/basic.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -233,6 +239,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
style="-ms-transform:rotate(90deg);transform:rotate(90deg)"
viewBox="64 64 896 896"
@ -277,6 +284,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -307,6 +315,7 @@ exports[`renders ./components/collapse/demo/borderless.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -345,6 +354,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
class=""
data-icon="caret-right"
fill="currentColor"
focusable="false"
height="1em"
style="-ms-transform:rotate(90deg);transform:rotate(90deg)"
viewBox="0 0 1024 1024"
@ -392,6 +402,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
class=""
data-icon="caret-right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -423,6 +434,7 @@ exports[`renders ./components/collapse/demo/custom.md correctly 1`] = `
class=""
data-icon="caret-right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -460,6 +472,7 @@ exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
style="-ms-transform:rotate(90deg);transform:rotate(90deg)"
viewBox="64 64 896 896"
@ -484,6 +497,7 @@ exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -529,6 +543,7 @@ exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -552,6 +567,7 @@ exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -582,6 +598,7 @@ exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -605,6 +622,7 @@ exports[`renders ./components/collapse/demo/extra.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -642,6 +660,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -672,6 +691,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -702,6 +722,7 @@ exports[`renders ./components/collapse/demo/mix.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -739,6 +760,7 @@ exports[`renders ./components/collapse/demo/noarrow.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
style="-ms-transform:rotate(90deg);transform:rotate(90deg)"
viewBox="64 64 896 896"

2
components/collapse/__tests__/__snapshots__/index.test.js.snap

@ -22,6 +22,7 @@ exports[`Collapse should render extra node of panel 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -61,6 +62,7 @@ exports[`Collapse should render extra node of panel 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/comment/__tests__/__snapshots__/demo.test.js.snap

@ -62,6 +62,7 @@ exports[`renders ./components/comment/demo/basic.md correctly 1`] = `
class=""
data-icon="like"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -90,6 +91,7 @@ exports[`renders ./components/comment/demo/basic.md correctly 1`] = `
class=""
data-icon="dislike"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

486
components/config-provider/__tests__/__snapshots__/components.test.js.snap

File diff suppressed because it is too large

2
components/config-provider/renderEmpty.tsx

@ -10,7 +10,7 @@ const renderEmpty = (componentName?: string): React.ReactNode => (
switch (componentName) {
case 'Table':
case 'List':
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} className={`${prefix}-normal`} />;
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
case 'Select':
case 'TreeSelect':

25
components/date-picker/__tests__/DatePicker.test.js

@ -7,6 +7,8 @@ import { selectDate, openPanel, clearInput, nextYear, nextMonth, hasSelected } f
import focusTest from '../../../tests/shared/focusTest';
describe('DatePicker', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
focusTest(DatePicker);
beforeEach(() => {
@ -15,6 +17,11 @@ describe('DatePicker', () => {
afterEach(() => {
MockDate.reset();
errorSpy.mockReset();
});
afterAll(() => {
errorSpy.mockRestore();
});
it('support name prop', () => {
@ -210,4 +217,22 @@ describe('DatePicker', () => {
wrapper.find('.ant-calendar-input').simulate('change', { target: { value: '02/07/18' } });
expect(wrapper.find('.ant-calendar-picker-input').getDOMNode().value).toBe('02/07/2018');
});
describe('warning use if use invalidate moment', () => {
const invalidateTime = moment('I AM INVALIDATE');
it('defaultValue', () => {
mount(<DatePicker defaultValue={invalidateTime} />);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: DatePicker] `defaultValue` provides invalidate moment time. If you want to set empty value, use `null` instead.',
);
});
it('value', () => {
mount(<DatePicker value={invalidateTime} />);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: DatePicker] `value` provides invalidate moment time. If you want to set empty value, use `null` instead.',
);
});
});
});

3
components/date-picker/__tests__/__snapshots__/DatePicker.test.js.snap

@ -20,6 +20,7 @@ exports[`DatePicker disabled date 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -56,6 +57,7 @@ exports[`DatePicker prop locale should works 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -74,6 +76,7 @@ exports[`DatePicker prop locale should works 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap

@ -36,6 +36,7 @@ exports[`RangePicker customize separator 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/date-picker/__tests__/__snapshots__/WeekPicker.test.js.snap

@ -809,6 +809,7 @@ exports[`WeekPicker should support style prop 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

41
components/date-picker/__tests__/__snapshots__/demo.test.js.snap

@ -21,6 +21,7 @@ exports[`renders ./components/date-picker/demo/basic.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -52,6 +53,7 @@ exports[`renders ./components/date-picker/demo/basic.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -99,6 +101,7 @@ exports[`renders ./components/date-picker/demo/basic.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -132,6 +135,7 @@ exports[`renders ./components/date-picker/demo/basic.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -167,6 +171,7 @@ exports[`renders ./components/date-picker/demo/date-render.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -213,6 +218,7 @@ exports[`renders ./components/date-picker/demo/date-render.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -249,6 +255,7 @@ exports[`renders ./components/date-picker/demo/disabled.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -281,6 +288,7 @@ exports[`renders ./components/date-picker/demo/disabled.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -330,6 +338,7 @@ exports[`renders ./components/date-picker/demo/disabled.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -366,6 +375,7 @@ exports[`renders ./components/date-picker/demo/disabled-date.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -397,6 +407,7 @@ exports[`renders ./components/date-picker/demo/disabled-date.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -445,6 +456,7 @@ exports[`renders ./components/date-picker/demo/disabled-date.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -480,6 +492,7 @@ exports[`renders ./components/date-picker/demo/extra-footer.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -511,6 +524,7 @@ exports[`renders ./components/date-picker/demo/extra-footer.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -557,6 +571,7 @@ exports[`renders ./components/date-picker/demo/extra-footer.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -604,6 +619,7 @@ exports[`renders ./components/date-picker/demo/extra-footer.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -634,6 +650,7 @@ exports[`renders ./components/date-picker/demo/extra-footer.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -670,6 +687,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -688,6 +706,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -720,6 +739,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -738,6 +758,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -770,6 +791,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -788,6 +810,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -836,6 +859,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -854,6 +878,7 @@ exports[`renders ./components/date-picker/demo/format.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -890,6 +915,7 @@ exports[`renders ./components/date-picker/demo/mode.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -937,6 +963,7 @@ exports[`renders ./components/date-picker/demo/mode.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -988,6 +1015,7 @@ exports[`renders ./components/date-picker/demo/presetted-ranges.md correctly 1`]
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1036,6 +1064,7 @@ exports[`renders ./components/date-picker/demo/presetted-ranges.md correctly 1`]
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1135,6 +1164,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1166,6 +1196,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1213,6 +1244,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1246,6 +1278,7 @@ exports[`renders ./components/date-picker/demo/size.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1282,6 +1315,7 @@ exports[`renders ./components/date-picker/demo/start-end.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1313,6 +1347,7 @@ exports[`renders ./components/date-picker/demo/start-end.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1348,6 +1383,7 @@ exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1379,6 +1415,7 @@ exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1426,6 +1463,7 @@ exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1459,6 +1497,7 @@ exports[`renders ./components/date-picker/demo/suffix.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1585,6 +1624,7 @@ exports[`renders ./components/date-picker/demo/time.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1633,6 +1673,7 @@ exports[`renders ./components/date-picker/demo/time.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

8
components/date-picker/__tests__/__snapshots__/other.test.js.snap

@ -995,6 +995,7 @@ exports[`Picker format by locale date 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1013,6 +1014,7 @@ exports[`Picker format by locale date 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1048,6 +1050,7 @@ exports[`Picker format by locale dateTime 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1066,6 +1069,7 @@ exports[`Picker format by locale dateTime 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1100,6 +1104,7 @@ exports[`Picker format by locale month 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1118,6 +1123,7 @@ exports[`Picker format by locale month 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1154,6 +1160,7 @@ exports[`Picker format by locale week 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1172,6 +1179,7 @@ exports[`Picker format by locale week 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/date-picker/style/RangePicker.less

@ -22,6 +22,7 @@
white-space: nowrap;
text-align: center;
vertical-align: top;
pointer-events: none;
}
.@{calendar-prefix-cls}-range {
@ -71,6 +72,7 @@
line-height: @input-box-height;
text-align: center;
transform: translateX(-50%);
pointer-events: none;
}
&-right .@{calendar-prefix-cls}-date-input-wrap {

32
components/date-picker/wrapPicker.tsx

@ -1,10 +1,13 @@
import * as React from 'react';
import { polyfill } from 'react-lifecycles-compat';
import TimePickerPanel from 'rc-time-picker/lib/Panel';
import classNames from 'classnames';
import * as moment from 'moment';
import enUS from './locale/en_US';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import { generateShowHourMinuteSecond } from '../time-picker';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
type PickerType = 'date' | 'week' | 'month';
@ -43,8 +46,21 @@ function getColumns({ showHour, showMinute, showSecond, use12Hours }: any) {
return column;
}
function checkValidate(value: any, propName: string) {
const values: any[] = Array.isArray(value) ? value : [value];
values.forEach(val => {
if (!val) return;
warning(
!moment.isMoment(val) || val.isValid(),
'DatePicker',
`\`${propName}\` provides invalidate moment time. If you want to set empty value, use \`null\` instead.`,
);
});
}
export default function wrapPicker(Picker: React.ComponentClass<any>, pickerType: PickerType): any {
return class PickerWrapper extends React.Component<any, any> {
class PickerWrapper extends React.Component<any, any> {
static defaultProps = {
transitionName: 'slide-up',
popupStyle: {},
@ -54,6 +70,15 @@ export default function wrapPicker(Picker: React.ComponentClass<any>, pickerType
locale: {},
};
static getDerivedStateFromProps({ value, defaultValue }: any) {
checkValidate(defaultValue, 'defaultValue');
checkValidate(value, 'value');
return {};
}
// Since we need call `getDerivedStateFromProps` for check. Need leave an empty `state` here.
state = {};
private picker: any;
componentDidMount() {
@ -199,5 +224,8 @@ export default function wrapPicker(Picker: React.ComponentClass<any>, pickerType
</LocaleReceiver>
);
}
};
}
polyfill(PickerWrapper);
return PickerWrapper;
}

5
components/drawer/__tests__/__snapshots__/Drawer.test.js.snap

@ -37,6 +37,7 @@ exports[`Drawer className is test_drawer 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -130,6 +131,7 @@ exports[`Drawer destroyOnClose is true 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -195,6 +197,7 @@ exports[`Drawer have a title 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -255,6 +258,7 @@ exports[`Drawer render correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -314,6 +318,7 @@ exports[`Drawer render top drawer 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/drawer/__tests__/__snapshots__/DrawerEvent.test.js.snap

@ -46,6 +46,7 @@ exports[`Drawer render correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/drawer/__tests__/__snapshots__/demo.test.js.snap

@ -28,6 +28,7 @@ exports[`renders ./components/drawer/demo/form-in-drawer.md correctly 1`] = `
class=""
data-icon="plus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

9
components/dropdown/__tests__/__snapshots__/demo.test.js.snap

@ -15,6 +15,7 @@ exports[`renders ./components/dropdown/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -62,6 +63,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
class=""
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -100,6 +102,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
class=""
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -128,6 +131,7 @@ exports[`renders ./components/dropdown/demo/dropdown-button.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -156,6 +160,7 @@ exports[`renders ./components/dropdown/demo/event.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -183,6 +188,7 @@ exports[`renders ./components/dropdown/demo/item.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -210,6 +216,7 @@ exports[`renders ./components/dropdown/demo/overlay-visible.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -291,6 +298,7 @@ exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -318,6 +326,7 @@ exports[`renders ./components/dropdown/demo/trigger.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/dropdown/__tests__/__snapshots__/dropdown-button.test.js.snap

@ -21,6 +21,7 @@ exports[`DropdownButton should support href like Button 1`] = `
class=""
data-icon="ellipsis"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

74
components/empty/__tests__/__snapshots__/demo.test.js.snap

@ -9,7 +9,7 @@ exports[`renders ./components/empty/demo/basic.md correctly 1`] = `
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTg0IiBoZWlnaHQ9IjE1MiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMjQgMzEuNjcpIj4KICAgICAgPGVsbGlwc2UgZmlsbC1vcGFjaXR5PSIuOCIgZmlsbD0iI0Y1RjVGNyIgY3g9IjY3Ljc5NyIgY3k9IjEwNi44OSIgcng9IjY3Ljc5NyIgcnk9IjEyLjY2OC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OTUtMTAuMTE4IDE4LjA5Ny0yMi41OTkgMTguMDk3LTQuNTI4IDAtOC43NDQtMS4wNjYtMTIuMjgtMi45MDJ6IiBmaWxsPSIjRENFMEU2Ii8+CiAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNDkuNjUgMTUuMzgzKSIgZmlsbD0iI0ZGRiI+CiAgICAgIDxlbGxpcHNlIGN4PSIyMC42NTQiIGN5PSIzLjE2NyIgcng9IjIuODQ5IiByeT0iMi44MTUiLz4KICAgICAgPHBhdGggZD0iTTUuNjk4IDUuNjNIMEwyLjg5OC43MDR6TTkuMjU5LjcwNGg0Ljk4NVY1LjYzSDkuMjU5eiIvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg=="
/>
</div>
<p
@ -74,6 +74,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -119,6 +120,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -159,6 +161,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -214,14 +217,14 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class="ant-transfer-list-body-not-found"
>
<div
class="ant-empty ant-empty-small"
class="ant-empty ant-empty-normal ant-empty-small"
>
<div
class="ant-empty-image"
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KIC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m9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -250,6 +253,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -274,6 +278,7 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -324,14 +329,14 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
class="ant-transfer-list-body-not-found"
>
<div
class="ant-empty ant-empty-small"
class="ant-empty ant-empty-normal ant-empty-small"
>
<div
class="ant-empty-image"
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgP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4PSIzMiIgY3k9IjMzIiByeD0iMzIiIHJ5PSI3Ii8+CiAgICA8ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -380,30 +385,38 @@ exports[`renders ./components/empty/demo/config-provider.md correctly 1`] = `
<th
class=""
>
<div>
<span
class="ant-table-column-title"
>
Name
</span>
<span
class="ant-table-column-sorter"
/>
</div>
<span
class="ant-table-header-column"
>
<div>
<span
class="ant-table-column-title"
>
Name
</span>
<span
class="ant-table-column-sorter"
/>
</div>
</span>
</th>
<th
class=""
>
<div>
<span
class="ant-table-column-title"
>
Age
</span>
<span
class="ant-table-column-sorter"
/>
</div>
<span
class="ant-table-header-column"
>
<div>
<span
class="ant-table-column-title"
>
Age
</span>
<span
class="ant-table-column-sorter"
/>
</div>
</span>
</th>
</tr>
</thead>
@ -423,7 +436,7 @@ exports[`renders ./components/empty/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bGU9Im5vbnplcm8iIHN0cm9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -484,7 +497,7 @@ exports[`renders ./components/empty/demo/customize.md correctly 1`] = `
>
<div
class="ant-empty-image"
style="height:200px"
style="height:60px"
>
<img
alt="empty"
@ -520,15 +533,14 @@ exports[`renders ./components/empty/demo/customize.md correctly 1`] = `
exports[`renders ./components/empty/demo/simple.md correctly 1`] = `
<div
class="ant-empty"
class="ant-empty ant-empty-normal"
>
<div
class="ant-empty-image"
style="height:40px"
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbG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0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p

2
components/empty/demo/customize.md

@ -20,7 +20,7 @@ ReactDOM.render(
<Empty
image="https://gw.alipayobjects.com/mdn/miniapp_social/afts/img/A*pevERLJC9v0AAAAAAAAAAABjAQAAAQ/original"
imageStyle={{
height: 200,
height: 60,
}}
description={
<span>

2
components/empty/demo/simple.md

@ -17,7 +17,7 @@ You can choose another style of `image` by setting image to `Empty.PRESENTED_IMA
import { Empty } from 'antd';
ReactDOM.render(
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} imageStyle={{ height:40 }} />,
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />,
mountNode
);
```

2
components/empty/empty.svg

@ -1,4 +1,4 @@
<svg width="184" height="152" xmlns="http://www.w3.org/2000/svg">
<svg width="184" height="152" viewBox="0 0 184 152" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<g transform="translate(24 31.67)">
<ellipse fill-opacity=".8" fill="#F5F5F7" cx="67.797" cy="106.89" rx="67.797" ry="12.668"/>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

13
components/empty/index.tsx

@ -51,13 +51,20 @@ const OriginEmpty: React.SFC<EmptyProps> = (props: EmptyProps) => (
}
return (
<div className={classNames(prefixCls, className)} {...restProps}>
<div
className={classNames(
prefixCls,
{
[`${prefixCls}-normal`]: image === simpleEmptyImg,
},
className,
)}
{...restProps}
>
<div className={`${prefixCls}-image`} style={imageStyle}>
{imageNode}
</div>
<p className={`${prefixCls}-description`}>{des}</p>
{children && <div className={`${prefixCls}-footer`}>{children}</div>}
</div>
);

2
components/empty/simple.svg

@ -1,4 +1,4 @@
<svg width="64" height="41" xmlns="http://www.w3.org/2000/svg">
<svg width="64" height="41" viewBox="0 0 64 41" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(0 1)" fill="none" fill-rule="evenodd">
<ellipse fill="#F5F5F5" cx="32" cy="33" rx="32" ry="7"/>
<g fill-rule="nonzero" stroke="#D9D9D9">

Before

Width:  |  Height:  |  Size: 657 B

After

Width:  |  Height:  |  Size: 678 B

14
components/empty/style/index.less

@ -27,19 +27,21 @@
}
// antd internal empty style
&-small {
margin: 8px 0;
&-normal {
margin: 32px 0;
color: @disabled-color;
.@{empty-prefix-cls}-image {
height: 35px;
height: 40px;
}
}
&-normal {
margin: 32px 0;
&-small {
margin: 8px 0;
color: @disabled-color;
.@{empty-prefix-cls}-image {
height: 40px;
height: 35px;
}
}
}

16
components/form/FormItem.tsx

@ -304,8 +304,7 @@ export default class FormItem extends React.Component<FormItemProps, any> {
// Resolve duplicated ids bug between different forms
// https://github.com/ant-design/ant-design/issues/7351
onLabelClick = (e: any) => {
const { label } = this.props;
onLabelClick = () => {
const id = this.props.id || this.getId();
if (!id) {
return;
@ -313,17 +312,8 @@ export default class FormItem extends React.Component<FormItemProps, any> {
const formItemNode = ReactDOM.findDOMNode(this) as Element;
const control = formItemNode.querySelector(`[id="${id}"]`) as HTMLElement;
if (control) {
// Only prevent in default situation
// Avoid preventing event in `label={<a href="xx">link</a>}``
if (typeof label === 'string') {
e.preventDefault();
}
if (control.focus) {
control.focus();
}
if (control && control.focus) {
control.focus();
}
};

60
components/form/__tests__/__snapshots__/demo.test.js.snap

@ -457,6 +457,7 @@ exports[`renders ./components/form/demo/advanced-search.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -581,6 +582,7 @@ exports[`renders ./components/form/demo/coordinated.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -697,6 +699,7 @@ exports[`renders ./components/form/demo/customized-form-controls.md correctly 1`
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -771,6 +774,7 @@ exports[`renders ./components/form/demo/dynamic-form-item.md correctly 1`] = `
class=""
data-icon="plus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1051,6 +1055,7 @@ exports[`renders ./components/form/demo/horizontal-login.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1103,6 +1108,7 @@ exports[`renders ./components/form/demo/horizontal-login.md correctly 1`] = `
class=""
data-icon="lock"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1371,6 +1377,7 @@ exports[`renders ./components/form/demo/normal-login.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1423,6 +1430,7 @@ exports[`renders ./components/form/demo/normal-login.md correctly 1`] = `
class=""
data-icon="lock"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1639,6 +1647,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
class=""
data-icon="question-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1728,6 +1737,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1746,6 +1756,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1835,6 +1846,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1945,6 +1957,7 @@ exports[`renders ./components/form/demo/register.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2202,6 +2215,7 @@ exports[`renders ./components/form/demo/style-check-debug.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2267,6 +2281,7 @@ exports[`renders ./components/form/demo/style-check-debug.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2293,6 +2308,7 @@ exports[`renders ./components/form/demo/style-check-debug.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2368,6 +2384,7 @@ exports[`renders ./components/form/demo/style-check-debug.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2509,6 +2526,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2568,6 +2586,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2626,6 +2645,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2700,6 +2720,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2775,6 +2796,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2814,7 +2836,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class="ant-form-item-children"
>
<span
class="ant-time-picker "
class="ant-time-picker"
>
<input
class="ant-time-picker-input"
@ -2835,6 +2857,7 @@ exports[`renders ./components/form/demo/time-related-controls.md correctly 1`] =
class=""
data-icon="clock-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2979,6 +3002,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3116,6 +3140,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3142,6 +3167,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3723,6 +3749,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3745,6 +3772,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3779,6 +3807,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3801,6 +3830,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3835,6 +3865,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3857,6 +3888,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3891,6 +3923,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3913,6 +3946,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3947,6 +3981,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -3969,6 +4004,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4212,6 +4248,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -4272,6 +4309,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4327,6 +4365,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4382,6 +4421,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4443,6 +4483,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4466,6 +4507,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4503,7 +4545,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class="ant-form-item-children"
>
<span
class="ant-time-picker "
class="ant-time-picker"
style="width:100%"
>
<input
@ -4525,6 +4567,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="clock-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4551,6 +4594,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4625,6 +4669,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4649,6 +4694,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4710,6 +4756,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4728,6 +4775,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4750,6 +4798,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -4824,6 +4873,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4881,6 +4931,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4945,6 +4996,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -4971,6 +5023,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -5008,6 +5061,7 @@ exports[`renders ./components/form/demo/validate-static.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -5073,6 +5127,7 @@ exports[`renders ./components/form/demo/without-form-create.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -5099,6 +5154,7 @@ exports[`renders ./components/form/demo/without-form-create.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

8
components/form/demo/customized-form-controls.md

@ -11,8 +11,8 @@ title:
> * 提供受控属性 `value` 或其它与 [`valuePropName`](http://ant.design/components/form/#getFieldDecorator-参数) 的值同名的属性。
> * 提供 `onChange` 事件或 [`trigger`](http://ant.design/components/form/#getFieldDecorator-参数) 的值同名的事件。
> * 支持 ref:
> * React@16.8.0 之前只有 Class 组件支持。
> * React@16.8.0 及之后可以通过 [useImperativeHandle](https://reactjs.org/docs/hooks-reference.html#useimperativehandle) 添加 ref 支持。([示例](https://codesandbox.io/s/31mv8004rp))
> * React@16.3.0 之前只有 Class 组件支持。
> * React@16.3.0 及之后可以通过 [forwardRef](https://reactjs.org/docs/forwarding-refs.html) 添加 ref 支持。([示例](https://codesandbox.io/s/7wj199900x))
## en-US
@ -20,8 +20,8 @@ Customized or third-party form controls can be used in Form, too. Controls must
> * It has a controlled property `value` or other name which is equal to the value of [`valuePropName`](http://ant.design/components/form/?locale=en-US#getFieldDecorator's-parameters).
> * It has event `onChange` or an event which name is equal to the value of [`trigger`](http://ant.design/components/form/?locale=en-US#getFieldDecorator's-parameters).
> * Support ref:
> * Can only use class component before React@16.8.0.
> * Can use [useImperativeHandle](https://reactjs.org/docs/hooks-reference.html#useimperativehandle) to add ref support after React@16.8.0. ([Sample](https://codesandbox.io/s/31mv8004rp))
> * Can only use class component before React@16.3.0.
> * Can use [forwardRef](https://reactjs.org/docs/forwarding-refs.html) to add ref support after React@16.3.0. ([Sample](https://codesandbox.io/s/7wj199900x))
````jsx
import {

2
components/form/demo/global-state.md

@ -17,6 +17,8 @@ We can store form data into upper component or [Redux](https://github.com/reactj
**Note:** You must wrap field data with `Form.createFormField` in `mapPropsToFields`.
**Note:** Here, errors are passed to higher order component in `onFieldsChange` and passed back in `mapPropsToFields`.
````jsx
import { Form, Input } from 'antd';

4
components/form/index.en-US.md

@ -57,10 +57,10 @@ The following `options` are available:
| Property | Description | Type |
| -------- | ----------- | ---- |
| mapPropsToFields | Convert props to field value(e.g. reading the values from Redux store). And you must mark returned fields with [`Form.createFormField`](#Form.createFormField) | (props) => ({ \[fieldName\]: FormField { value } }) |
| mapPropsToFields | Convert props to field value(e.g. reading the values from Redux store). And you must mark returned fields with [`Form.createFormField`](#Form.createFormField). Please note that the form fields will become controlled components. Properties like errors will not be automatically mapped and need to be manually passed in. | (props) => ({ \[fieldName\]: FormField { value } }) |
| name | Set the id prefix of fields under form | - |
| validateMessages | Default validate message. And its format is similar with [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js)'s returned value | Object { \[nested.path]: String } |
| onFieldsChange | Specify a function that will be called when the value a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
| onFieldsChange | Specify a function that will be called when the fields (including errors) of a `Form.Item` gets changed. Usage example: saving the field's value to Redux store. | Function(props, fields) |
| onValuesChange | A handler while value of any field is changed | (props, changedValues, allValues) => void |
If you want to get `ref` after `Form.create`, you can use `wrappedComponentRef` provided by `rc-form`, [details can be viewed here](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140).

4
components/form/index.zh-CN.md

@ -59,10 +59,10 @@ CustomizedForm = Form.create({})(CustomizedForm);
| 参数 | 说明 | 类型 |
| --- | --- | --- |
| mapPropsToFields | 把父组件的属性映射到表单项上(如:把 Redux store 中的值读出),需要对返回值中的表单域数据用 [`Form.createFormField`](#Form.createFormField) 标记 | (props) => ({ \[fieldName\]: FormField { value } }) |
| mapPropsToFields | 把父组件的属性映射到表单项上(如:把 Redux store 中的值读出),需要对返回值中的表单域数据用 [`Form.createFormField`](#Form.createFormField) 标记,注意表单项将变成受控组件, error 等也需要一并手动传入 | (props) => ({ \[fieldName\]: FormField { value } }) |
| name | 设置表单域内字段 id 的前缀 | - |
| validateMessages | 默认校验信息,可用于把默认错误信息改为中文等,格式与 [newMessages](https://github.com/yiminghe/async-validator/blob/master/src/messages.js) 返回值一致 | Object { \[nested.path]: String } |
| onFieldsChange | 当 `Form.Item` 子节点的值发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) |
| onFieldsChange | 当 `Form.Item` 子节点的值(包括 error)发生改变时触发,可以把对应的值转存到 Redux store | Function(props, fields) |
| onValuesChange | 任一表单域的值发生改变时的回调 | (props, changedValues, allValues) => void |
经过 `Form.create` 之后如果要拿到 `ref`,可以使用 `rc-form` 提供的 `wrappedComponentRef`,[详细内容可以查看这里](https://github.com/react-component/form#note-use-wrappedcomponentref-instead-of-withref-after-rc-form140)。

4
components/form/style/index.less

@ -456,7 +456,7 @@ form {
}
.has-warning {
.form-control-validation(@warning-color; @warning-color;);
.form-control-validation(@warning-color; @warning-color; @form-warning-input-bg;);
&.has-feedback .@{form-prefix-cls}-item-children-icon {
color: @warning-color;
@ -505,7 +505,7 @@ form {
}
.has-error {
.form-control-validation(@error-color; @error-color;);
.form-control-validation(@error-color; @error-color; @form-error-input-bg;);
&.has-feedback .@{form-prefix-cls}-item-children-icon {
color: @error-color;

1
components/form/style/mixin.less

@ -30,6 +30,7 @@
.@{ant-prefix}-input {
&,
&:hover {
background-color: @background-color;
border-color: @border-color;
}

12
components/icon/__tests__/__snapshots__/index.test.js.snap

@ -38,6 +38,7 @@ exports[`Icon should render to a <i class="xxx"><svg>...</svg></i> 1`] = `
class=""
data-icon="message"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -60,6 +61,7 @@ exports[`Icon should support basic usage 1`] = `
class=""
data-icon="home"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -78,6 +80,7 @@ exports[`Icon should support basic usage 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -96,6 +99,7 @@ exports[`Icon should support basic usage 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -114,6 +118,7 @@ exports[`Icon should support basic usage 1`] = `
class="anticon-spin"
data-icon="sync"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -132,6 +137,7 @@ exports[`Icon should support basic usage 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -154,6 +160,7 @@ exports[`Icon should support config global two-tone primary color 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -185,6 +192,7 @@ exports[`Icon should support older usage 1`] = `
class=""
data-icon="home"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -203,6 +211,7 @@ exports[`Icon should support older usage 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -221,6 +230,7 @@ exports[`Icon should support older usage 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -239,6 +249,7 @@ exports[`Icon should support older usage 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -309,6 +320,7 @@ exports[`Icon should support two-tone icon 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

4
components/icon/index.en-US.md

@ -9,10 +9,6 @@ Semantic vector graphics.
## List of icons
> Click the icon and copy the code.
We are still adding two-tone icons right now.
```__react
import IconDisplay from 'site/theme/template/IconDisplay';
ReactDOM.render(<IconDisplay />, mountNode);

4
components/icon/index.zh-CN.md

@ -14,10 +14,6 @@ toc: false
## 图标列表
> 点击图标即可复制代码。
新版图标可能略有缺失,我们还在持续补充中。
```__react
import IconDisplay from 'site/theme/template/IconDisplay';
ReactDOM.render(<IconDisplay />, mountNode);

16
components/input-number/__tests__/__snapshots__/demo.test.js.snap

@ -23,6 +23,7 @@ exports[`renders ./components/input-number/demo/basic.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -49,6 +50,7 @@ exports[`renders ./components/input-number/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -102,6 +104,7 @@ exports[`renders ./components/input-number/demo/digit.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -128,6 +131,7 @@ exports[`renders ./components/input-number/demo/digit.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -181,6 +185,7 @@ exports[`renders ./components/input-number/demo/disabled.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -207,6 +212,7 @@ exports[`renders ./components/input-number/demo/disabled.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -275,6 +281,7 @@ exports[`renders ./components/input-number/demo/formatter.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -301,6 +308,7 @@ exports[`renders ./components/input-number/demo/formatter.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -349,6 +357,7 @@ exports[`renders ./components/input-number/demo/formatter.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -375,6 +384,7 @@ exports[`renders ./components/input-number/demo/formatter.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -430,6 +440,7 @@ exports[`renders ./components/input-number/demo/size.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -456,6 +467,7 @@ exports[`renders ./components/input-number/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -506,6 +518,7 @@ exports[`renders ./components/input-number/demo/size.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -532,6 +545,7 @@ exports[`renders ./components/input-number/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -582,6 +596,7 @@ exports[`renders ./components/input-number/demo/size.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -608,6 +623,7 @@ exports[`renders ./components/input-number/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/input/__tests__/__snapshots__/Search.test.js.snap

@ -28,6 +28,7 @@ exports[`Input.Search should support addonAfter 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -78,6 +79,7 @@ exports[`Input.Search should support addonAfter 2`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

20
components/input/__tests__/__snapshots__/demo.test.js.snap

@ -80,6 +80,7 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -140,6 +141,7 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -182,6 +184,7 @@ exports[`renders ./components/input/demo/addon.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -329,6 +332,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -390,6 +394,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -430,6 +435,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="up"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -456,6 +462,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -512,6 +519,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -566,6 +574,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -616,6 +625,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -671,6 +681,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -748,6 +759,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -818,6 +830,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -874,6 +887,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -912,6 +926,7 @@ exports[`renders ./components/input/demo/group.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -950,6 +965,7 @@ exports[`renders ./components/input/demo/password-input.md correctly 1`] = `
class=""
data-icon="eye-invisible"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -983,6 +999,7 @@ exports[`renders ./components/input/demo/presuffix.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1012,6 +1029,7 @@ exports[`renders ./components/input/demo/presuffix.md correctly 1`] = `
class=""
data-icon="info-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1053,6 +1071,7 @@ exports[`renders ./components/input/demo/search-input.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1094,6 +1113,7 @@ exports[`renders ./components/input/demo/search-input.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

5
components/input/__tests__/__snapshots__/index.test.js.snap

@ -48,6 +48,7 @@ exports[`Input allowClear should change type when click 1`] = `
className=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
key="svg-close-circle"
viewBox="64 64 896 896"
@ -346,6 +347,7 @@ exports[`Input.Password should change type when click 1`] = `
className=""
data-icon="eye-invisible"
fill="currentColor"
focusable="false"
height="1em"
key="svg-eye-invisible"
viewBox="64 64 896 896"
@ -436,6 +438,7 @@ exports[`Input.Password should change type when click 2`] = `
className=""
data-icon="eye"
fill="currentColor"
focusable="false"
height="1em"
key="svg-eye"
viewBox="64 64 896 896"
@ -522,6 +525,7 @@ exports[`Input.Password should change type when click 3`] = `
className=""
data-icon="eye-invisible"
fill="currentColor"
focusable="false"
height="1em"
key="svg-eye-invisible"
viewBox="64 64 896 896"
@ -611,6 +615,7 @@ exports[`Input.Search should support suffix 1`] = `
className=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
key="svg-search"
viewBox="64 64 896 896"

76
components/layout/Sider.tsx

@ -1,4 +1,6 @@
import createContext, { Context } from 'create-react-context';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import { LayoutContext, LayoutContextProps } from './layout';
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82
@ -18,7 +20,6 @@ import * as React from 'react';
import { polyfill } from 'react-lifecycles-compat';
import classNames from 'classnames';
import omit from 'omit.js';
import * as PropTypes from 'prop-types';
import Icon from '../icon';
import isNumeric from '../_util/isNumeric';
@ -31,6 +32,13 @@ const dimensionMap = {
xxl: '1600px',
};
export interface SiderContextProps {
siderCollapsed?: boolean;
collapsedWidth?: string | number;
}
export const SiderContext: Context<SiderContextProps> = createContext({});
export type CollapseType = 'clickTrigger' | 'responsive';
export type SiderTheme = 'light' | 'dark';
@ -50,16 +58,14 @@ export interface SiderProps extends React.HTMLAttributes<HTMLDivElement> {
onBreakpoint?: (broken: boolean) => void;
}
type InternalSideProps = SiderProps & LayoutContextProps;
export interface SiderState {
collapsed?: boolean;
below: boolean;
belowShow?: boolean;
}
export interface SiderContext {
siderCollapsed: boolean;
}
const generateId = (() => {
let i = 0;
return (prefix: string = '') => {
@ -68,9 +74,7 @@ const generateId = (() => {
};
})();
class Sider extends React.Component<SiderProps, SiderState> {
static __ANT_LAYOUT_SIDER: any = true;
class InternalSider extends React.Component<InternalSideProps, SiderState> {
static defaultProps = {
collapsible: false,
defaultCollapsed: false,
@ -81,16 +85,7 @@ class Sider extends React.Component<SiderProps, SiderState> {
theme: 'dark' as SiderTheme,
};
static childContextTypes = {
siderCollapsed: PropTypes.bool,
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
};
static contextTypes = {
siderHook: PropTypes.object,
};
static getDerivedStateFromProps(nextProps: SiderProps) {
static getDerivedStateFromProps(nextProps: InternalSideProps) {
if ('collapsed' in nextProps) {
return {
collapsed: nextProps.collapsed,
@ -99,12 +94,10 @@ class Sider extends React.Component<SiderProps, SiderState> {
return null;
}
context: any;
private mql: MediaQueryList;
private uniqueId: string;
constructor(props: SiderProps) {
constructor(props: InternalSideProps) {
super(props);
this.uniqueId = generateId('ant-sider-');
let matchMedia;
@ -126,21 +119,14 @@ class Sider extends React.Component<SiderProps, SiderState> {
};
}
getChildContext() {
return {
siderCollapsed: this.state.collapsed,
collapsedWidth: this.props.collapsedWidth,
};
}
componentDidMount() {
if (this.mql) {
this.mql.addListener(this.responsiveHandler);
this.responsiveHandler(this.mql);
}
if (this.context.siderHook) {
this.context.siderHook.addSider(this.uniqueId);
if (this.props.siderHook) {
this.props.siderHook.addSider(this.uniqueId);
}
}
@ -149,8 +135,8 @@ class Sider extends React.Component<SiderProps, SiderState> {
this.mql.removeListener(this.responsiveHandler as any);
}
if (this.context.siderHook) {
this.context.siderHook.removeSider(this.uniqueId);
if (this.props.siderHook) {
this.props.siderHook.removeSider(this.uniqueId);
}
}
@ -206,6 +192,7 @@ class Sider extends React.Component<SiderProps, SiderState> {
'onCollapse',
'breakpoint',
'onBreakpoint',
'siderHook',
]);
const rawWidth = this.state.collapsed ? collapsedWidth : width;
// use "px" as fallback unit for width
@ -262,10 +249,29 @@ class Sider extends React.Component<SiderProps, SiderState> {
};
render() {
return <ConfigConsumer>{this.renderSider}</ConfigConsumer>;
const { collapsed } = this.state;
const { collapsedWidth } = this.props;
return (
<SiderContext.Provider
value={{
siderCollapsed: collapsed,
collapsedWidth,
}}
>
<ConfigConsumer>{this.renderSider}</ConfigConsumer>
</SiderContext.Provider>
);
}
}
polyfill(Sider);
polyfill(InternalSider);
export default Sider;
export default class Sider extends React.Component {
render() {
return (
<LayoutContext.Consumer>
{(context: LayoutContextProps) => <InternalSider {...context} {...this.props} />}
</LayoutContext.Consumer>
);
}
}

28
components/layout/__tests__/__snapshots__/demo.test.js.snap

@ -155,6 +155,7 @@ exports[`renders ./components/layout/demo/custom-trigger.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -182,6 +183,7 @@ exports[`renders ./components/layout/demo/custom-trigger.md correctly 1`] = `
class=""
data-icon="video-camera"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -209,6 +211,7 @@ exports[`renders ./components/layout/demo/custom-trigger.md correctly 1`] = `
class=""
data-icon="upload"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -242,6 +245,7 @@ exports[`renders ./components/layout/demo/custom-trigger.md correctly 1`] = `
class=""
data-icon="menu-fold"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -462,6 +466,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -491,6 +496,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="video-camera"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -520,6 +526,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="upload"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -549,6 +556,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="bar-chart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -578,6 +586,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="cloud"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -607,6 +616,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -636,6 +646,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="team"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -665,6 +676,7 @@ exports[`renders ./components/layout/demo/fixed-sider.md correctly 1`] = `
class=""
data-icon="shop"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -837,6 +849,7 @@ exports[`renders ./components/layout/demo/responsive.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -866,6 +879,7 @@ exports[`renders ./components/layout/demo/responsive.md correctly 1`] = `
class=""
data-icon="video-camera"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -895,6 +909,7 @@ exports[`renders ./components/layout/demo/responsive.md correctly 1`] = `
class=""
data-icon="upload"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -924,6 +939,7 @@ exports[`renders ./components/layout/demo/responsive.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1002,6 +1018,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class=""
data-icon="pie-chart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1029,6 +1046,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class=""
data-icon="desktop"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1062,6 +1080,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1101,6 +1120,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class=""
data-icon="team"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1134,6 +1154,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class=""
data-icon="file"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1162,6 +1183,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1585,6 +1607,7 @@ exports[`renders ./components/layout/demo/top-side.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1655,6 +1678,7 @@ exports[`renders ./components/layout/demo/top-side.md correctly 1`] = `
class=""
data-icon="laptop"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1692,6 +1716,7 @@ exports[`renders ./components/layout/demo/top-side.md correctly 1`] = `
class=""
data-icon="notification"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1872,6 +1897,7 @@ exports[`renders ./components/layout/demo/top-side-2.md correctly 1`] = `
class=""
data-icon="user"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1942,6 +1968,7 @@ exports[`renders ./components/layout/demo/top-side-2.md correctly 1`] = `
class=""
data-icon="laptop"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1979,6 +2006,7 @@ exports[`renders ./components/layout/demo/top-side-2.md correctly 1`] = `
class=""
data-icon="notification"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/layout/__tests__/demo.test.js

@ -1,3 +1,3 @@
import demoTest from '../../../tests/shared/demoTest';
demoTest('layout');
demoTest('layout', { skip: ['custom-trigger-debug.md'] });

36
components/layout/__tests__/index.test.js

@ -1,6 +1,8 @@
import React from 'react';
import { mount, render } from 'enzyme';
import Layout from '..';
import Icon from '../../icon';
import Menu from '../../menu';
const { Sider, Content } = Layout;
@ -91,9 +93,9 @@ describe('Layout', () => {
it('should be controlled by collapsed', () => {
const wrapper = mount(<Sider>Sider</Sider>);
expect(wrapper.instance().state.collapsed).toBe(false);
expect(wrapper.find('InternalSider').instance().state.collapsed).toBe(false);
wrapper.setProps({ collapsed: true });
expect(wrapper.instance().state.collapsed).toBe(true);
expect(wrapper.find('InternalSider').instance().state.collapsed).toBe(true);
});
it('should not add ant-layout-has-sider when `hasSider` is `false`', () => {
@ -104,6 +106,36 @@ describe('Layout', () => {
);
expect(wrapper.find('.ant-layout').hasClass('ant-layout-has-sider')).toBe(false);
});
it('render correct with Tooltip', () => {
jest.useFakeTimers();
const wrapper = mount(
<Sider collapsible collapsed={false}>
<Menu mode="inline">
<Menu.Item key="1">
<Icon type="user" />
<span>Light</span>
</Menu.Item>
</Menu>
</Sider>,
);
wrapper.find('.ant-menu-item').simulate('mouseenter');
jest.runAllTimers();
wrapper.update();
expect(wrapper.find('.ant-tooltip-inner').length).toBeFalsy();
wrapper.find('.ant-menu-item').simulate('mouseout');
jest.runAllTimers();
wrapper.update();
wrapper.setProps({ collapsed: true });
wrapper.find('.ant-menu-item').simulate('mouseenter');
jest.runAllTimers();
wrapper.update();
expect(wrapper.find('.ant-tooltip-inner').length).toBeTruthy();
jest.useRealTimers();
});
});
describe('Sider onBreakpoint', () => {

125
components/layout/demo/custom-trigger-debug.md

@ -0,0 +1,125 @@
---
order: 99
title:
zh-CN: 自定义触发器 Debug
en-US: Custom trigger debug
debug: true
---
## zh-CN
修改内容前,请尝试此 Demo 查看样式是否抖动。
````jsx
import { Layout, Menu, Icon } from 'antd';
const { Header, Sider, Content } = Layout;
const SubMenu = Menu.SubMenu;
class SiderDemo extends React.Component {
state = {
collapsed: true,
};
toggle = () => {
this.setState({
collapsed: !this.state.collapsed,
});
};
render() {
return (
<Layout>
<Sider trigger={null} collapsible collapsed={this.state.collapsed}>
<div className="logo" />
<Menu
theme="dark"
mode="inline"
defaultSelectedKeys={['3']}
defaultOpenKeys={['sub1']}
>
<Menu.Item key="1">
<Icon type="pie-chart" />
<span>Option 1</span>
</Menu.Item>
<Menu.Item key="2">
<Icon type="desktop" />
<span>Option 2</span>
</Menu.Item>
<SubMenu
key="sub1"
title={
<span>
<Icon type="user" />
<span>User</span>
</span>
}
>
<Menu.Item key="3">Tom</Menu.Item>
<Menu.Item key="4">Bill</Menu.Item>
<Menu.Item key="5">Alex</Menu.Item>
</SubMenu>
<SubMenu
key="sub2"
title={
<span>
<Icon type="team" />
<span>Team</span>
</span>
}
>
<Menu.Item key="6">Team 1</Menu.Item>
<Menu.Item key="8">Team 2</Menu.Item>
</SubMenu>
<Menu.Item key="9">
<Icon type="file" />
<span>File</span>
</Menu.Item>
</Menu>
</Sider>
<Layout>
<Header style={{ background: '#fff', padding: 0 }}>
<Icon
className="trigger"
type={this.state.collapsed ? 'menu-unfold' : 'menu-fold'}
onClick={this.toggle}
/>
</Header>
<Content
style={{
margin: '24px 16px',
padding: 24,
background: '#fff',
minHeight: 280,
}}
>
Content
</Content>
</Layout>
</Layout>
);
}
}
ReactDOM.render(<SiderDemo />, mountNode);
````
````css
#components-layout-demo-custom-trigger .trigger {
font-size: 18px;
line-height: 64px;
padding: 0 24px;
cursor: pointer;
transition: color .3s;
}
#components-layout-demo-custom-trigger .trigger:hover {
color: #1890ff;
}
#components-layout-demo-custom-trigger .logo {
height: 32px;
background: rgba(255,255,255,.2);
margin: 16px;
}
````

51
components/layout/layout.tsx

@ -1,6 +1,6 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import classNames from 'classnames';
import createContext, { Context } from 'create-react-context';
import { SiderProps } from './Sider';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
@ -13,6 +13,19 @@ export interface BasicProps extends React.HTMLAttributes<HTMLDivElement> {
hasSider?: boolean;
}
export interface LayoutContextProps {
siderHook: {
addSider: (id: string) => void;
removeSider: (id: string) => void;
};
}
export const LayoutContext: Context<LayoutContextProps> = createContext({
siderHook: {
addSider: () => null,
removeSider: () => null,
},
});
interface BasicPropsWithTagName extends BasicProps {
tagName: 'header' | 'footer' | 'main' | 'section';
}
@ -52,35 +65,37 @@ interface BasicLayoutState {
}
class BasicLayout extends React.Component<BasicPropsWithTagName, BasicLayoutState> {
static childContextTypes = {
siderHook: PropTypes.object,
};
state = { siders: [] };
getChildContext() {
getSiderHook() {
return {
siderHook: {
addSider: (id: string) => {
this.setState(state => ({
siders: [...state.siders, id],
}));
},
removeSider: (id: string) => {
this.setState(state => ({
siders: state.siders.filter(currentId => currentId !== id),
}));
},
addSider: (id: string) => {
this.setState(state => ({
siders: [...state.siders, id],
}));
},
removeSider: (id: string) => {
this.setState(state => ({
siders: state.siders.filter(currentId => currentId !== id),
}));
},
};
}
render() {
const { prefixCls, className, children, hasSider, tagName, ...others } = this.props;
const { prefixCls, className, children, hasSider, tagName: Tag, ...others } = this.props;
const classString = classNames(className, prefixCls, {
[`${prefixCls}-has-sider`]:
typeof hasSider === 'boolean' ? hasSider : this.state.siders.length > 0,
});
return React.createElement(tagName, { className: classString, ...others }, children);
return (
<LayoutContext.Provider value={{ siderHook: this.getSiderHook() }}>
<Tag className={classString} {...others}>
{children}
</Tag>
</LayoutContext.Provider>
);
}
}

13
components/list/__tests__/__snapshots__/demo.test.js.snap

@ -336,7 +336,7 @@ exports[`renders ./components/list/demo/infinite-load.md correctly 1`] = `
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiN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AgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -901,6 +901,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -928,6 +929,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="like"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -955,6 +957,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="message"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1034,6 +1037,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1061,6 +1065,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="like"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1088,6 +1093,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="message"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1167,6 +1173,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1194,6 +1201,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="like"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1221,6 +1229,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="message"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1282,6 +1291,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1383,6 +1393,7 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/list/__tests__/__snapshots__/empty.test.js.snap

@ -21,7 +21,7 @@ exports[`List renders empty list 1`] = `
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNUY1RjUiIGN4PSIzMiIgY3k9IjMzIiByeD0iMzIiIHJ5PSI3Ii8+CiAgICA8ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iI0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jQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p

317
components/list/__tests__/__snapshots__/pagination.test.js.snap

@ -50,6 +50,7 @@ exports[`List.pagination renders pagination correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -97,6 +98,7 @@ exports[`List.pagination renders pagination correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -112,3 +114,318 @@ exports[`List.pagination renders pagination correctly 1`] = `
</div>
</div>
`;
exports[`List.pagination should change page size work 1`] = `
<ul
class="ant-pagination "
unselectable="unselectable"
>
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
title="Previous Page"
>
<a
class="ant-pagination-item-link"
>
<i
aria-label="icon: left"
class="anticon anticon-left"
>
<svg
aria-hidden="true"
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"
/>
</svg>
</i>
</a>
</li>
<li
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
tabindex="0"
title="1"
>
<a>
1
</a>
</li>
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-next"
title="Next Page"
>
<a
class="ant-pagination-item-link"
>
<i
aria-label="icon: right"
class="anticon anticon-right"
>
<svg
aria-hidden="true"
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"
/>
</svg>
</i>
</a>
</li>
<li
class="ant-pagination-options"
>
<div
class="ant-pagination-options-size-changer ant-select ant-select-enabled"
>
<div
aria-autocomplete="list"
aria-controls="test-uuid"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--single"
role="combobox"
tabindex="0"
>
<div
class="ant-select-selection__rendered"
>
<div
class="ant-select-selection-selected-value"
style="display: block; opacity: 1;"
title="10 / page"
>
10 / page
</div>
</div>
<span
class="ant-select-arrow"
style="user-select: none;"
unselectable="on"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-select-arrow-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
</div>
</div>
</li>
</ul>
`;
exports[`List.pagination should change page size work 2`] = `
<ul
class="ant-pagination "
unselectable="unselectable"
>
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-prev"
title="Previous Page"
>
<a
class="ant-pagination-item-link"
>
<i
aria-label="icon: left"
class="anticon anticon-left"
>
<svg
aria-hidden="true"
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"
/>
</svg>
</i>
</a>
</li>
<li
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
tabindex="0"
title="1"
>
<a>
1
</a>
</li>
<li
aria-disabled="true"
class="ant-pagination-disabled ant-pagination-next"
title="Next Page"
>
<a
class="ant-pagination-item-link"
>
<i
aria-label="icon: right"
class="anticon anticon-right"
>
<svg
aria-hidden="true"
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"
/>
</svg>
</i>
</a>
</li>
<li
class="ant-pagination-options"
>
<div
class="ant-pagination-options-size-changer ant-select ant-select-focused ant-select-enabled"
style=""
>
<div
aria-autocomplete="list"
aria-controls="test-uuid"
aria-expanded="false"
aria-haspopup="true"
class="ant-select-selection
ant-select-selection--single"
role="combobox"
tabindex="0"
>
<div
class="ant-select-selection__rendered"
>
<div
class="ant-select-selection-selected-value"
style="display: block; opacity: 1;"
title="30 / page"
>
30 / page
</div>
</div>
<span
class="ant-select-arrow"
style="user-select: none;"
unselectable="on"
>
<i
aria-label="icon: down"
class="anticon anticon-down ant-select-arrow-icon"
>
<svg
aria-hidden="true"
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</i>
</span>
</div>
</div>
<div>
<div
class="ant-select-dropdown ant-select-dropdown--single ant-select-dropdown-placement-bottomLeft slide-up-leave"
style="left: -999px; top: -995px;"
>
<div
id="test-uuid"
style="overflow: auto; transform: translateZ(0);"
>
<ul
class="ant-select-dropdown-menu ant-select-dropdown-menu-root ant-select-dropdown-menu-vertical"
role="listbox"
tabindex="0"
>
<li
aria-selected="false"
class="ant-select-dropdown-menu-item"
role="option"
style="user-select: none;"
unselectable="on"
>
10 / page
</li>
<li
aria-selected="false"
class="ant-select-dropdown-menu-item"
role="option"
style="user-select: none;"
unselectable="on"
>
20 / page
</li>
<li
aria-selected="true"
class="ant-select-dropdown-menu-item ant-select-dropdown-menu-item-selected"
role="option"
style="user-select: none;"
unselectable="on"
>
30 / page
</li>
<li
aria-selected="false"
class="ant-select-dropdown-menu-item"
role="option"
style="user-select: none;"
unselectable="on"
>
40 / page
</li>
</ul>
</div>
</div>
</div>
</li>
</ul>
`;

28
components/list/__tests__/pagination.test.js

@ -105,8 +105,9 @@ describe('List.pagination', () => {
expect(wrapper.find('.ant-pagination')).toHaveLength(0);
wrapper.setProps({ pagination: true });
expect(wrapper.find('.ant-pagination')).toHaveLength(1);
expect(wrapper.find('.ant-pagination-item')).toHaveLength(1); // pageSize will be 10
expect(renderedNames(wrapper)).toEqual(['Jack', 'Lucy', 'Tom', 'Jerry']);
// Legacy code will make pageSize ping with 10, here we fixed to keep sync by current one
expect(wrapper.find('.ant-pagination-item')).toHaveLength(2);
expect(renderedNames(wrapper)).toEqual(['Tom', 'Jerry']);
});
// https://github.com/ant-design/ant-design/issues/5259
@ -151,4 +152,27 @@ describe('List.pagination', () => {
.find('.ant-pagination'),
).toHaveLength(1);
});
it('should change page size work', () => {
const wrapper = mount(createList({ pagination: { showSizeChanger: true } }));
expect(
wrapper
.find('Pagination')
.first()
.render(),
).toMatchSnapshot();
wrapper.find('.ant-select-selection-selected-value').simulate('click');
wrapper
.find('.ant-select-dropdown-menu .ant-select-dropdown-menu-item')
.at(2)
.simulate('click');
expect(
wrapper
.find('Pagination')
.first()
.render(),
).toMatchSnapshot();
});
});

44
components/list/index.tsx

@ -57,7 +57,12 @@ export interface ListLocale {
emptyText: React.ReactNode | (() => React.ReactNode);
}
export default class List<T> extends React.Component<ListProps<T>> {
interface ListState {
paginationCurrent: number;
paginationSize: number;
}
export default class List<T> extends React.Component<ListProps<T>, ListState> {
static Item: typeof Item = Item;
static childContextTypes = {
@ -75,25 +80,20 @@ export default class List<T> extends React.Component<ListProps<T>> {
state = {
paginationCurrent: 1,
paginationSize: 10,
};
defaultPaginationProps = {
current: 1,
pageSize: 10,
onChange: (page: number, pageSize: number) => {
const { pagination } = this.props;
this.setState({
paginationCurrent: page,
});
if (pagination && pagination.onChange) {
pagination.onChange(page, pageSize);
}
},
total: 0,
};
private keys: { [key: string]: string } = {};
private onPaginationChange = this.triggerPaginationEvent('onChange');
private onPaginationShowSizeChange = this.triggerPaginationEvent('onShowSizeChange');
getChildContext() {
return {
grid: this.props.grid,
@ -101,6 +101,19 @@ export default class List<T> extends React.Component<ListProps<T>> {
};
}
triggerPaginationEvent(eventName: string) {
return (page: number, pageSize: number) => {
const { pagination } = this.props;
this.setState({
paginationCurrent: page,
paginationSize: pageSize,
});
if (pagination && (pagination as any)[eventName]) {
(pagination as any)[eventName](page, pageSize);
}
};
}
renderItem = (item: any, index: number) => {
const { renderItem, rowKey } = this.props;
let key;
@ -138,7 +151,7 @@ export default class List<T> extends React.Component<ListProps<T>> {
};
renderList = ({ getPrefixCls, renderEmpty }: ConfigConsumerProps) => {
const { paginationCurrent } = this.state;
const { paginationCurrent, paginationSize } = this.state;
const {
prefixCls: customizePrefixCls,
bordered,
@ -196,6 +209,7 @@ export default class List<T> extends React.Component<ListProps<T>> {
...this.defaultPaginationProps,
total: dataSource.length,
current: paginationCurrent,
pageSize: paginationSize,
...(pagination || {}),
};
@ -205,7 +219,11 @@ export default class List<T> extends React.Component<ListProps<T>> {
}
const paginationContent = pagination ? (
<div className={`${prefixCls}-pagination`}>
<Pagination {...paginationProps} onChange={this.defaultPaginationProps.onChange} />
<Pagination
{...paginationProps}
onChange={this.onPaginationChange}
onShowSizeChange={this.onPaginationShowSizeChange}
/>
</div>
) : null;

2
components/list/style/index.less

@ -32,7 +32,7 @@
&-empty-text {
padding: @list-empty-text-padding;
color: @text-color-secondary;
color: @disabled-color;
font-size: @font-size-base;
text-align: center;
}

77
components/locale-provider/__tests__/__snapshots__/demo.test.js.snap

@ -80,6 +80,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -154,6 +155,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -206,6 +208,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -275,6 +278,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -306,6 +310,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -318,7 +323,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
</div>
</span>
<span
class="ant-time-picker "
class="ant-time-picker"
>
<input
class="ant-time-picker-input"
@ -339,6 +344,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="clock-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -389,6 +395,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -497,6 +504,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -513,14 +521,14 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class="ant-transfer-list-body-not-found"
>
<div
class="ant-empty ant-empty-small"
class="ant-empty ant-empty-normal ant-empty-small"
>
<div
class="ant-empty-image"
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNUY1RjUiIGN4PSIzMiIgY3k9IjMzIiByeD0iMzIiIHJ5PSI3Ii8+CiAgICA8ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLj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IyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -549,6 +557,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -573,6 +582,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -641,6 +651,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="search"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -657,14 +668,14 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class="ant-transfer-list-body-not-found"
>
<div
class="ant-empty ant-empty-small"
class="ant-empty ant-empty-normal ant-empty-small"
>
<div
class="ant-empty-image"
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNUY1RjUiIGN4PSIzMiIgY3k9IjMzIiByeD0iMzIiI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yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAgMS42MDUgMS4wMDUgMi45MDEgMi4yMzcgMi45MDFoMTQuNzUyYzEuMjMyIDAgMi4yMzctMS4zMDggMi4yMzctMi45MTN2LS4wMDd6IiBmaWxsPSIjRkFGQUZBIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -725,6 +736,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -775,6 +787,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1756,16 +1769,20 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
<th
class="ant-table-column-has-actions ant-table-column-has-filters"
>
<div>
<span
class="ant-table-column-title"
>
Name
</span>
<span
class="ant-table-column-sorter"
/>
</div>
<span
class="ant-table-header-column"
>
<div>
<span
class="ant-table-column-title"
>
Name
</span>
<span
class="ant-table-column-sorter"
/>
</div>
</span>
<i
aria-label="icon: filter"
class="anticon anticon-filter ant-dropdown-trigger"
@ -1777,6 +1794,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
class=""
data-icon="filter"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1790,16 +1808,20 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
<th
class=""
>
<div>
<span
class="ant-table-column-title"
>
Age
</span>
<span
class="ant-table-column-sorter"
/>
</div>
<span
class="ant-table-header-column"
>
<div>
<span
class="ant-table-column-title"
>
Age
</span>
<span
class="ant-table-column-sorter"
/>
</div>
</span>
</th>
</tr>
</thead>
@ -1819,7 +1841,7 @@ exports[`renders ./components/locale-provider/demo/all.md correctly 1`] = `
>
<img
alt="No Data"
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjQiIGhlaWdodD0iNDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxKSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgIDxlbGxpcHNlIGZpbGw9IiNGNUY1RjUiIGN4PSIzMiIgY3k9IjMzIiByeD0iMzIiIHJ5PSI3Ii8+CiAgICA8ZyBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iI0Q5RDlEOSI+CiAgICAgIDxwYXRoIGQ9Ik01NSAxMi43Nkw0NC44NTQgMS4yNThDNDQuMzY3LjQ3NCA0My42NTYgMCA0Mi45MDcgMEgyMS4wOTNjLS43NDkgMC0xLjQ2LjQ3NC0xLjk0NyAxLjI1N0w5IDEyLjc2MVYyMmg0NnYtOS4yNHoiLz4KICAgICAgPHBhdGggZD0iTTQxLjYxMyAxNS45MzFjMC0xLjYwNS45OTQtMi45MyAyLjIyNy0yLjkzMUg1NXYxOC4xMzdDNTUgMzMuMjYgNTMuNjggMzUgNTIuMDUgMzVoLTQwLjFDMTAuMzIgMzUgOSAzMy4yNTkgOSAzMS4xMzdWMTNoMTEuMTZjMS4yMzMgMCAyLjIyNyAxLjMyMyAyLjIyNyAyLjkyOHYuMDIyYzAg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gICA8L2c+CiAgPC9nPgo8L3N2Zz4K"
/>
</div>
<p
@ -1862,6 +1884,7 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1936,6 +1959,7 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1988,6 +2012,7 @@ exports[`renders ./components/locale-provider/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

3438
components/locale-provider/__tests__/__snapshots__/index.test.js.snap

File diff suppressed because it is too large

38
components/menu/MenuItem.tsx

@ -1,7 +1,9 @@
import * as React from 'react';
import { Item } from 'rc-menu';
import Tooltip from '../tooltip';
import { ClickParam } from '.';
import { MenuContext, MenuContextProps } from './';
import Tooltip from '../tooltip';
import { SiderContext, SiderContextProps } from '../layout/Sider';
export interface MenuItemProps {
rootPrefixCls?: string;
@ -28,17 +30,33 @@ export default class MenuItem extends React.Component<MenuItemProps> {
this.menuItem = menuItem;
};
render() {
const { rootPrefixCls, title, ...rest } = this.props;
renderItem = ({ siderCollapsed }: SiderContextProps) => {
const { level, children, rootPrefixCls } = this.props;
const { title, ...rest } = this.props;
return (
<Tooltip
title={title}
placement="right"
overlayClassName={`${rootPrefixCls}-inline-collapsed-tooltip`}
>
<Item {...rest} rootPrefixCls={rootPrefixCls} title={title} ref={this.saveMenuItem} />
</Tooltip>
<MenuContext.Consumer>
{({ inlineCollapsed }: MenuContextProps) => {
let titleNode = title || (level === 1 ? children : '');
if (!siderCollapsed && !inlineCollapsed) {
titleNode = null;
}
return (
<Tooltip
title={titleNode}
placement="right"
overlayClassName={`${rootPrefixCls}-inline-collapsed-tooltip`}
>
<Item {...rest} title={title} ref={this.saveMenuItem} />
</Tooltip>
);
}}
</MenuContext.Consumer>
);
};
render() {
return <SiderContext.Consumer>{this.renderItem}</SiderContext.Consumer>;
}
}

18
components/menu/SubMenu.tsx

@ -3,6 +3,8 @@ import * as PropTypes from 'prop-types';
import { SubMenu as RcSubMenu } from 'rc-menu';
import classNames from 'classnames';
import { MenuContext, MenuContextProps } from './index';
interface TitleEventEntity {
key: string;
domEvent: Event;
@ -25,7 +27,6 @@ class SubMenu extends React.Component<SubMenuProps, any> {
};
// fix issue:https://github.com/ant-design/ant-design/issues/8666
static isSubMenu = 1;
context: any;
private subMenu: any;
onKeyDown = (e: React.MouseEvent<HTMLElement>) => {
@ -38,13 +39,16 @@ class SubMenu extends React.Component<SubMenuProps, any> {
render() {
const { rootPrefixCls, className } = this.props;
const theme = this.context.antdMenuTheme;
return (
<RcSubMenu
{...this.props}
ref={this.saveSubMenu}
popupClassName={classNames(`${rootPrefixCls}-${theme}`, className)}
/>
<MenuContext.Consumer>
{({ antdMenuTheme }: MenuContextProps) => (
<RcSubMenu
{...this.props}
ref={this.saveSubMenu}
popupClassName={classNames(`${rootPrefixCls}-${antdMenuTheme}`, className)}
/>
)}
</MenuContext.Consumer>
);
}
}

25
components/menu/__tests__/__snapshots__/demo.test.js.snap

@ -36,6 +36,7 @@ exports[`renders ./components/menu/demo/horizontal.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -79,6 +80,7 @@ exports[`renders ./components/menu/demo/horizontal.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -129,6 +131,7 @@ exports[`renders ./components/menu/demo/horizontal.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -223,6 +226,7 @@ exports[`renders ./components/menu/demo/inline.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -323,6 +327,7 @@ exports[`renders ./components/menu/demo/inline.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -362,6 +367,7 @@ exports[`renders ./components/menu/demo/inline.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -402,6 +408,7 @@ exports[`renders ./components/menu/demo/inline-collapsed.md correctly 1`] = `
class=""
data-icon="menu-fold"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -430,6 +437,7 @@ exports[`renders ./components/menu/demo/inline-collapsed.md correctly 1`] = `
class=""
data-icon="pie-chart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -457,6 +465,7 @@ exports[`renders ./components/menu/demo/inline-collapsed.md correctly 1`] = `
class=""
data-icon="desktop"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -484,6 +493,7 @@ exports[`renders ./components/menu/demo/inline-collapsed.md correctly 1`] = `
class=""
data-icon="inbox"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -518,6 +528,7 @@ exports[`renders ./components/menu/demo/inline-collapsed.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -590,6 +601,7 @@ exports[`renders ./components/menu/demo/inline-collapsed.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -640,6 +652,7 @@ exports[`renders ./components/menu/demo/sider-current.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -712,6 +725,7 @@ exports[`renders ./components/menu/demo/sider-current.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -751,6 +765,7 @@ exports[`renders ./components/menu/demo/sider-current.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -822,6 +837,7 @@ exports[`renders ./components/menu/demo/switch-mode.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -847,6 +863,7 @@ exports[`renders ./components/menu/demo/switch-mode.md correctly 1`] = `
class=""
data-icon="calendar"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -879,6 +896,7 @@ exports[`renders ./components/menu/demo/switch-mode.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -955,6 +973,7 @@ exports[`renders ./components/menu/demo/switch-mode.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1021,6 +1040,7 @@ exports[`renders ./components/menu/demo/theme.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1093,6 +1113,7 @@ exports[`renders ./components/menu/demo/theme.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1132,6 +1153,7 @@ exports[`renders ./components/menu/demo/theme.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1180,6 +1202,7 @@ exports[`renders ./components/menu/demo/vertical.md correctly 1`] = `
class=""
data-icon="mail"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1217,6 +1240,7 @@ exports[`renders ./components/menu/demo/vertical.md correctly 1`] = `
class=""
data-icon="appstore"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1254,6 +1278,7 @@ exports[`renders ./components/menu/demo/vertical.md correctly 1`] = `
class=""
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

73
components/menu/__tests__/__snapshots__/index.test.js.snap

@ -0,0 +1,73 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Menu should controlled collapse work 1`] = `
<ul
class="ant-menu ant-menu-light ant-menu-root ant-menu-inline"
role="menu"
>
<li
class="ant-menu-item"
role="menuitem"
style="padding-left: 24px;"
>
<i
aria-label="icon: pie-chart"
class="anticon anticon-pie-chart"
>
<svg
aria-hidden="true"
class=""
data-icon="pie-chart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M864 518H506V160c0-4.4-3.6-8-8-8h-26a398.46 398.46 0 0 0-282.8 117.1 398.19 398.19 0 0 0-85.7 127.1A397.61 397.61 0 0 0 72 552a398.46 398.46 0 0 0 117.1 282.8c36.7 36.7 79.5 65.6 127.1 85.7A397.61 397.61 0 0 0 472 952a398.46 398.46 0 0 0 282.8-117.1c36.7-36.7 65.6-79.5 85.7-127.1A397.61 397.61 0 0 0 872 552v-26c0-4.4-3.6-8-8-8zM705.7 787.8A331.59 331.59 0 0 1 470.4 884c-88.1-.4-170.9-34.9-233.2-97.2C174.5 724.1 140 640.7 140 552c0-88.7 34.5-172.1 97.2-234.8 54.6-54.6 124.9-87.9 200.8-95.5V586h364.3c-7.7 76.3-41.3 147-96.6 201.8zM952 462.4l-2.6-28.2c-8.5-92.1-49.4-179-115.2-244.6A399.4 399.4 0 0 0 589 74.6L560.7 72c-4.7-.4-8.7 3.2-8.7 7.9V464c0 4.4 3.6 8 8 8l384-1c4.7 0 8.4-4 8-8.6zm-332.2-58.2V147.6a332.24 332.24 0 0 1 166.4 89.8c45.7 45.6 77 103.6 90 166.1l-256.4.7z"
/>
</svg>
</i>
<span>
Option 1
</span>
</li>
</ul>
`;
exports[`Menu should controlled collapse work 2`] = `
<ul
class="ant-menu ant-menu-light ant-menu-inline-collapsed ant-menu-root ant-menu-inline"
role="menu"
>
<li
class="ant-menu-item"
role="menuitem"
style="padding-left: 24px;"
>
<i
aria-label="icon: pie-chart"
class="anticon anticon-pie-chart"
>
<svg
aria-hidden="true"
class=""
data-icon="pie-chart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M864 518H506V160c0-4.4-3.6-8-8-8h-26a398.46 398.46 0 0 0-282.8 117.1 398.19 398.19 0 0 0-85.7 127.1A397.61 397.61 0 0 0 72 552a398.46 398.46 0 0 0 117.1 282.8c36.7 36.7 79.5 65.6 127.1 85.7A397.61 397.61 0 0 0 472 952a398.46 398.46 0 0 0 282.8-117.1c36.7-36.7 65.6-79.5 85.7-127.1A397.61 397.61 0 0 0 872 552v-26c0-4.4-3.6-8-8-8zM705.7 787.8A331.59 331.59 0 0 1 470.4 884c-88.1-.4-170.9-34.9-233.2-97.2C174.5 724.1 140 640.7 140 552c0-88.7 34.5-172.1 97.2-234.8 54.6-54.6 124.9-87.9 200.8-95.5V586h364.3c-7.7 76.3-41.3 147-96.6 201.8zM952 462.4l-2.6-28.2c-8.5-92.1-49.4-179-115.2-244.6A399.4 399.4 0 0 0 589 74.6L560.7 72c-4.7-.4-8.7 3.2-8.7 7.9V464c0 4.4 3.6 8 8 8l384-1c4.7 0 8.4-4 8-8.6zm-332.2-58.2V147.6a332.24 332.24 0 0 1 166.4 89.8c45.7 45.6 77 103.6 90 166.1l-256.4.7z"
/>
</svg>
</i>
<span>
Option 1
</span>
</li>
</ul>
`;

82
components/menu/__tests__/index.test.js

@ -3,6 +3,7 @@ import { mount } from 'enzyme';
import Menu from '..';
import Icon from '../../icon';
import Layout from '../../layout';
import raf from '../../_util/raf';
jest.mock('mutationobserver-shim', () => {
global.MutationObserver = function MutationObserver() {
@ -73,6 +74,10 @@ describe('Menu', () => {
.at(0)
.hasClass('ant-menu-hidden'),
).not.toBe(true);
const rafCount = Object.keys(raf.ids).length;
wrapper.unmount();
expect(Object.keys(raf.ids).length).toBe(rafCount - 1);
});
it('should accept defaultOpenKeys in mode vertical', () => {
@ -494,6 +499,8 @@ describe('Menu', () => {
const text = wrapper.find('.ant-tooltip-inner').text();
expect(text).toBe('bamboo lucky');
jest.useRealTimers();
});
it('render correctly when using with Layout.Sider', () => {
@ -556,37 +563,13 @@ describe('Menu', () => {
it('get correct animation type when switched from inline', () => {
const wrapper = mount(<Menu mode="inline" />);
wrapper.setProps({ mode: 'horizontal' });
expect(wrapper.instance().getMenuOpenAnimation('')).toBe('');
expect(wrapper.instance().switchingModeFromInline).toBe(false);
});
it('Menu should not shake when collapsed changed', () => {
const wrapper = mount(
<Menu
defaultSelectedKeys={['5']}
defaultOpenKeys={['sub1']}
mode="inline"
inlineCollapsed={false}
>
<SubMenu
key="sub1"
title={
<span>
<span>Navigation One</span>
</span>
}
>
<Menu.Item key="5">Option 5</Menu.Item>
<Menu.Item key="6">Option 6</Menu.Item>
</SubMenu>
</Menu>,
);
expect(wrapper.instance().contextSiderCollapsed).toBe(true);
wrapper.setProps({ inlineCollapsed: true });
expect(wrapper.instance().contextSiderCollapsed).toBe(false);
jest.runAllTimers();
wrapper.update();
expect(wrapper.instance().contextSiderCollapsed).toBe(false);
expect(
wrapper
.find('InternalMenu')
.instance()
.getMenuOpenAnimation(''),
).toBe('');
expect(wrapper.find('InternalMenu').state().switchingModeFromInline).toBe(false);
});
it('MenuItem should not render Tooltip when inlineCollapsed is false', () => {
@ -615,4 +598,41 @@ describe('Menu', () => {
wrapper.update();
expect(wrapper.find('.ant-tooltip-inner').length).toBe(0);
});
it('should controlled collapse work', () => {
const wrapper = mount(
<Menu mode="inline" inlineCollapsed={false}>
<Menu.Item key="1">
<Icon type="pie-chart" />
<span>Option 1</span>
</Menu.Item>
</Menu>,
);
expect(wrapper.render()).toMatchSnapshot();
wrapper.setProps({ inlineCollapsed: true });
expect(wrapper.render()).toMatchSnapshot();
});
it('not title if not collapsed', () => {
jest.useFakeTimers();
const wrapper = mount(
<Menu mode="inline" inlineCollapsed={false}>
<Menu.Item key="1">
<Icon type="pie-chart" />
<span>Option 1</span>
</Menu.Item>
</Menu>,
);
wrapper.find('.ant-menu-item').simulate('mouseenter');
jest.runAllTimers();
wrapper.update();
expect(wrapper.find('.ant-tooltip-inner').length).toBeFalsy();
jest.useRealTimers();
});
});

185
components/menu/index.tsx

@ -1,13 +1,16 @@
import * as React from 'react';
import RcMenu, { Divider, ItemGroup } from 'rc-menu';
import * as PropTypes from 'prop-types';
import createContext, { Context } from 'create-react-context';
import classNames from 'classnames';
import omit from 'omit.js';
import SubMenu from './SubMenu';
import Item from './MenuItem';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
import animation from '../_util/openAnimation';
import warning from '../_util/warning';
import { polyfill } from 'react-lifecycles-compat';
import { SiderContext, SiderContextProps } from '../layout/Sider';
import raf from '../_util/raf';
export interface SelectParam {
key: string;
@ -57,42 +60,73 @@ export interface MenuProps {
overflowedIndicator?: React.ReactNode;
}
type InternalMenuProps = MenuProps & SiderContextProps;
export interface MenuState {
openKeys: string[];
// This may be not best way since origin code use `this.switchingModeFromInline` to handle collapse management.
// But for current test, seems it's OK just use state.
switchingModeFromInline: boolean;
inlineOpenKeys: string[];
prevProps: InternalMenuProps;
mounted: boolean;
}
class Menu extends React.Component<MenuProps, MenuState> {
static Divider = Divider;
static Item = Item;
static SubMenu = SubMenu;
static ItemGroup = ItemGroup;
export interface MenuContextProps {
inlineCollapsed: boolean;
antdMenuTheme?: MenuTheme;
}
export const MenuContext: Context<MenuContextProps> = createContext({
inlineCollapsed: false,
});
class InternalMenu extends React.Component<InternalMenuProps, MenuState> {
static defaultProps: Partial<MenuProps> = {
className: '',
theme: 'light', // or dark
focusable: false,
};
static childContextTypes = {
inlineCollapsed: PropTypes.bool,
antdMenuTheme: PropTypes.string,
};
static contextTypes = {
siderCollapsed: PropTypes.bool,
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
};
static getDerivedStateFromProps(nextProps: MenuProps) {
static getDerivedStateFromProps(nextProps: InternalMenuProps, prevState: MenuState) {
const { prevProps } = prevState;
const newState: Partial<MenuState> = {
prevProps: nextProps,
};
if (prevProps.mode === 'inline' && nextProps.mode !== 'inline') {
newState.switchingModeFromInline = true;
}
if ('openKeys' in nextProps) {
return { openKeys: nextProps.openKeys! };
newState.openKeys = nextProps.openKeys;
} else {
// [Legacy] Old code will return after `openKeys` changed.
// Not sure the reason, we should keep this logic still.
if (
(nextProps.inlineCollapsed && !prevProps.inlineCollapsed) ||
(nextProps.siderCollapsed && !prevProps.siderCollapsed)
) {
newState.switchingModeFromInline = true;
newState.inlineOpenKeys = prevState.openKeys;
newState.openKeys = [];
}
if (
(!nextProps.inlineCollapsed && prevProps.inlineCollapsed) ||
(!nextProps.siderCollapsed && prevProps.siderCollapsed)
) {
newState.openKeys = prevState.inlineOpenKeys;
newState.inlineOpenKeys = [];
}
}
return null;
return newState;
}
context: any;
switchingModeFromInline: boolean;
inlineOpenKeys: string[] = [];
contextSiderCollapsed: boolean = true;
private mountRafId: number;
constructor(props: MenuProps) {
constructor(props: InternalMenuProps) {
super(props);
warning(
@ -117,43 +151,34 @@ class Menu extends React.Component<MenuProps, MenuState> {
this.state = {
openKeys: openKeys || [],
switchingModeFromInline: false,
inlineOpenKeys: [],
prevProps: props,
mounted: false,
};
}
getChildContext() {
return {
inlineCollapsed: this.getInlineCollapsed(),
antdMenuTheme: this.props.theme,
};
// [Legacy] Origin code can render full defaultOpenKeys is caused by `rc-animate` bug.
// We have to workaround this to prevent animation on first render.
// https://github.com/ant-design/ant-design/issues/15966
componentDidMount() {
this.mountRafId = raf(() => {
this.setState({
mounted: true,
});
}, 10);
}
componentDidUpdate(prevProps: MenuProps) {
if (prevProps.mode === 'inline' && this.props.mode !== 'inline') {
this.switchingModeFromInline = true;
}
if (
(this.props.inlineCollapsed && !prevProps.inlineCollapsed) ||
(this.getInlineCollapsed() && this.contextSiderCollapsed)
) {
this.contextSiderCollapsed = false;
this.switchingModeFromInline = true;
this.inlineOpenKeys = this.state.openKeys;
this.setState({ openKeys: [] });
}
if (
(!this.props.inlineCollapsed && prevProps.inlineCollapsed) ||
(!this.getInlineCollapsed() && !this.contextSiderCollapsed)
) {
this.contextSiderCollapsed = true;
this.setState({ openKeys: this.inlineOpenKeys });
this.inlineOpenKeys = [];
}
componentWillUnmount() {
raf.cancel(this.mountRafId);
}
restoreModeVerticalFromInline() {
if (this.switchingModeFromInline) {
this.switchingModeFromInline = false;
this.setState({});
const { switchingModeFromInline } = this.state;
if (switchingModeFromInline) {
this.setState({
switchingModeFromInline: false,
});
}
}
@ -175,7 +200,7 @@ class Menu extends React.Component<MenuProps, MenuState> {
// Fix SVGElement e.target.className.indexOf is not a function
// https://github.com/ant-design/ant-design/issues/15699
const { className } = e.target as (HTMLElement | SVGElement);
const { className } = e.target as HTMLElement | SVGElement;
// SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during an animation.
const classNameValue =
Object.prototype.toString.call(className) === '[object SVGAnimatedString]'
@ -216,7 +241,7 @@ class Menu extends React.Component<MenuProps, MenuState> {
getRealMenuMode() {
const inlineCollapsed = this.getInlineCollapsed();
if (this.switchingModeFromInline && inlineCollapsed) {
if (this.state.switchingModeFromInline && inlineCollapsed) {
return 'inline';
}
const { mode } = this.props;
@ -225,11 +250,8 @@ class Menu extends React.Component<MenuProps, MenuState> {
getInlineCollapsed() {
const { inlineCollapsed } = this.props;
if (this.context.siderCollapsed !== undefined) {
return this.context.siderCollapsed;
}
if (this.contextSiderCollapsed) {
return false;
if (this.props.siderCollapsed !== undefined) {
return this.props.siderCollapsed;
}
return inlineCollapsed;
}
@ -245,9 +267,12 @@ class Menu extends React.Component<MenuProps, MenuState> {
} else {
// When mode switch from inline
// submenu should hide without animation
if (this.switchingModeFromInline) {
if (this.state.switchingModeFromInline) {
menuOpenAnimation = '';
this.switchingModeFromInline = false;
this.setState({
switchingModeFromInline: false,
});
// this.switchingModeFromInline = false;
} else {
menuOpenAnimation = 'zoom-big';
}
@ -257,7 +282,9 @@ class Menu extends React.Component<MenuProps, MenuState> {
}
renderMenu = ({ getPopupContainer, getPrefixCls }: ConfigConsumerProps) => {
const { prefixCls: customizePrefixCls, className, theme } = this.props;
const { mounted } = this.state;
const { prefixCls: customizePrefixCls, className, theme, collapsedWidth } = this.props;
const passProps = omit(this.props, ['collapsedWidth', 'siderCollapsed']);
const menuMode = this.getRealMenuMode();
const menuOpenAnimation = this.getMenuOpenAnimation(menuMode!);
@ -276,13 +303,12 @@ class Menu extends React.Component<MenuProps, MenuState> {
if (menuMode !== 'inline') {
// closing vertical popup submenu after click it
menuProps.onClick = this.handleClick;
menuProps.openTransitionName = menuOpenAnimation;
menuProps.openTransitionName = mounted ? menuOpenAnimation : '';
} else {
menuProps.openAnimation = menuOpenAnimation;
menuProps.openAnimation = mounted ? menuOpenAnimation : {};
}
// https://github.com/ant-design/ant-design/issues/8587
const { collapsedWidth } = this.context;
if (
this.getInlineCollapsed() &&
(collapsedWidth === 0 || collapsedWidth === '0' || collapsedWidth === '0px')
@ -293,7 +319,7 @@ class Menu extends React.Component<MenuProps, MenuState> {
return (
<RcMenu
getPopupContainer={getPopupContainer}
{...this.props}
{...passProps}
{...menuProps}
prefixCls={prefixCls}
onTransitionEnd={this.handleTransitionEnd}
@ -303,10 +329,33 @@ class Menu extends React.Component<MenuProps, MenuState> {
};
render() {
return <ConfigConsumer>{this.renderMenu}</ConfigConsumer>;
return (
<MenuContext.Provider
value={{
inlineCollapsed: this.getInlineCollapsed() || false,
antdMenuTheme: this.props.theme,
}}
>
<ConfigConsumer>{this.renderMenu}</ConfigConsumer>
</MenuContext.Provider>
);
}
}
polyfill(Menu);
polyfill(InternalMenu);
export default Menu;
// We should keep this as ref-able
export default class Menu extends React.Component<MenuProps, {}> {
static Divider = Divider;
static Item = Item;
static SubMenu = SubMenu;
static ItemGroup = ItemGroup;
render() {
return (
<SiderContext.Consumer>
{(context: SiderContextProps) => <InternalMenu {...this.props} {...context} />}
</SiderContext.Consumer>
);
}
}

6
components/menu/style/index.less

@ -218,8 +218,14 @@
position: absolute;
width: 6px;
height: 1.5px;
// background + background-image to makes before & after cross have same color.
// Since `linear-gradient` not work on IE9, we should hack it.
// ref: https://github.com/ant-design/ant-design/issues/15910
background: @menu-bg;
background: ~'@{menu-item-color} \9';
background-image: linear-gradient(to right, @menu-item-color, @menu-item-color);
background-image: ~'none \9';
border-radius: 2px;
transition: background 0.3s @ease-in-out, transform 0.3s @ease-in-out,
top 0.3s @ease-in-out;

1
components/menu/style/index.tsx

@ -2,4 +2,5 @@ import '../../style/index.less';
import './index.less';
// style dependencies
// deps-lint-skip: layout
import '../../tooltip/style';

2
components/modal/__tests__/__snapshots__/Modal.test.js.snap

@ -42,6 +42,7 @@ exports[`Modal render correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -135,6 +136,7 @@ exports[`Modal render without footer 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/notification/__tests__/__snapshots__/demo.test.js.snap

@ -85,6 +85,7 @@ exports[`renders ./components/notification/demo/placement.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

4
components/page-header/__tests__/__snapshots__/demo.test.js.snap

@ -16,6 +16,7 @@ exports[`renders ./components/page-header/demo/actions.md correctly 1`] = `
class=""
data-icon="arrow-left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -284,6 +285,7 @@ exports[`renders ./components/page-header/demo/actions.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -311,6 +313,7 @@ exports[`renders ./components/page-header/demo/actions.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -414,6 +417,7 @@ exports[`renders ./components/page-header/demo/basic.md correctly 1`] = `
class=""
data-icon="arrow-left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/pagination/Pagination.tsx

@ -34,6 +34,7 @@ export interface PaginationProps {
originalElement: React.ReactElement<HTMLElement>,
) => React.ReactNode;
role?: string;
showLessItems?: boolean;
}
export interface PaginationConfig extends PaginationProps {

29
components/pagination/__tests__/__snapshots__/demo.test.js.snap

@ -22,6 +22,7 @@ exports[`renders ./components/pagination/demo/basic.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -96,6 +97,7 @@ exports[`renders ./components/pagination/demo/basic.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -133,6 +135,7 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -209,6 +212,7 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
class=""
data-icon="double-right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -253,6 +257,7 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -305,6 +310,7 @@ exports[`renders ./components/pagination/demo/changer.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -344,6 +350,7 @@ exports[`renders ./components/pagination/demo/controlled.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -418,6 +425,7 @@ exports[`renders ./components/pagination/demo/controlled.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -511,6 +519,7 @@ exports[`renders ./components/pagination/demo/itemRender.md correctly 1`] = `
class=""
data-icon="double-right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -573,6 +582,7 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -649,6 +659,7 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
class=""
data-icon="double-right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -693,6 +704,7 @@ exports[`renders ./components/pagination/demo/jump.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -743,6 +755,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -817,6 +830,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -850,6 +864,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -924,6 +939,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -976,6 +992,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1025,6 +1042,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1099,6 +1117,7 @@ exports[`renders ./components/pagination/demo/mini.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1137,6 +1156,7 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1177,6 +1197,7 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
class=""
data-icon="double-left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1259,6 +1280,7 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
class=""
data-icon="double-right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1303,6 +1325,7 @@ exports[`renders ./components/pagination/demo/more.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1339,6 +1362,7 @@ exports[`renders ./components/pagination/demo/simple.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1384,6 +1408,7 @@ exports[`renders ./components/pagination/demo/simple.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1426,6 +1451,7 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1500,6 +1526,7 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1539,6 +1566,7 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
class=""
data-icon="left"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1613,6 +1641,7 @@ exports[`renders ./components/pagination/demo/total.md correctly 1`] = `
class=""
data-icon="right"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

1
components/pagination/index.en-US.md

@ -27,6 +27,7 @@ A long list can be divided into several pages by `Pagination`, and only one page
| itemRender | to customize item innerHTML | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
| pageSize | number of data items per page | number | - |
| pageSizeOptions | specify the sizeChanger options | string\[] | \['10', '20', '30', '40'] |
| showLessItems | show less page items | boolean | false |
| showQuickJumper | determine whether you can jump to pages directly | boolean \| `{ goButton: ReactNode }` | false |
| showSizeChanger | determine whether `pageSize` can be changed | boolean | false |
| showTotal | to display the total number and range | Function(total, range) | - |

1
components/pagination/index.zh-CN.md

@ -28,6 +28,7 @@ cols: 1
| itemRender | 用于自定义页码的结构,可用于优化 SEO | (page, type: 'page' \| 'prev' \| 'next', originalElement) => React.ReactNode | - |
| pageSize | 每页条数 | number | - |
| pageSizeOptions | 指定每页可以显示多少条 | string\[] | \['10', '20', '30', '40'] |
| showLessItems | show less page items | boolean | false |
| showQuickJumper | 是否可以快速跳转至某页 | boolean \| `{ goButton: ReactNode }` | false |
| showSizeChanger | 是否可以改变 pageSize | boolean | false |
| showTotal | 用于显示数据总量和当前数据顺序 | Function(total, range) | - |

4
components/popconfirm/__tests__/__snapshots__/index.test.js.snap

@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Popconfirm should show overlay when trigger is clicked 1`] = `"<div class=\\"ant-popover-content\\"><div class=\\"ant-popover-arrow\\"></div><div class=\\"ant-popover-inner\\" role=\\"tooltip\\"><div><div class=\\"ant-popover-inner-content\\"><div class=\\"ant-popover-message\\"><i aria-label=\\"icon: exclamation-circle\\" class=\\"anticon anticon-exclamation-circle\\"><svg viewBox=\\"64 64 896 896\\" class=\\"\\" data-icon=\\"exclamation-circle\\" width=\\"1em\\" height=\\"1em\\" fill=\\"currentColor\\" aria-hidden=\\"true\\"><path d=\\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z\\"></path></svg></i><div class=\\"ant-popover-message-title\\">code</div></div><div class=\\"ant-popover-buttons\\"><button type=\\"button\\" class=\\"ant-btn ant-btn-sm\\"><span>Cancel</span></button><button type=\\"button\\" class=\\"ant-btn ant-btn-primary ant-btn-sm\\"><span>OK</span></button></div></div></div></div></div>"`;
exports[`Popconfirm should show overlay when trigger is clicked 1`] = `"<div class=\\"ant-popover-content\\"><div class=\\"ant-popover-arrow\\"></div><div class=\\"ant-popover-inner\\" role=\\"tooltip\\"><div><div class=\\"ant-popover-inner-content\\"><div class=\\"ant-popover-message\\"><i aria-label=\\"icon: exclamation-circle\\" class=\\"anticon anticon-exclamation-circle\\"><svg viewBox=\\"64 64 896 896\\" class=\\"\\" data-icon=\\"exclamation-circle\\" width=\\"1em\\" height=\\"1em\\" fill=\\"currentColor\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z\\"></path></svg></i><div class=\\"ant-popover-message-title\\">code</div></div><div class=\\"ant-popover-buttons\\"><button type=\\"button\\" class=\\"ant-btn ant-btn-sm\\"><span>Cancel</span></button><button type=\\"button\\" class=\\"ant-btn ant-btn-primary ant-btn-sm\\"><span>OK</span></button></div></div></div></div></div>"`;
exports[`Popconfirm should show overlay when trigger is clicked 2`] = `"<div class=\\"ant-popover-content\\"><div class=\\"ant-popover-arrow\\"></div><div class=\\"ant-popover-inner\\" role=\\"tooltip\\"><div><div class=\\"ant-popover-inner-content\\"><div class=\\"ant-popover-message\\"><i aria-label=\\"icon: exclamation-circle\\" class=\\"anticon anticon-exclamation-circle\\"><svg viewBox=\\"64 64 896 896\\" class=\\"\\" data-icon=\\"exclamation-circle\\" width=\\"1em\\" height=\\"1em\\" fill=\\"currentColor\\" aria-hidden=\\"true\\"><path d=\\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z\\"></path></svg></i><div class=\\"ant-popover-message-title\\">code</div></div><div class=\\"ant-popover-buttons\\"><button type=\\"button\\" class=\\"ant-btn ant-btn-sm\\"><span>Cancel</span></button><button type=\\"button\\" class=\\"ant-btn ant-btn-primary ant-btn-sm\\"><span>OK</span></button></div></div></div></div></div>"`;
exports[`Popconfirm should show overlay when trigger is clicked 2`] = `"<div class=\\"ant-popover-content\\"><div class=\\"ant-popover-arrow\\"></div><div class=\\"ant-popover-inner\\" role=\\"tooltip\\"><div><div class=\\"ant-popover-inner-content\\"><div class=\\"ant-popover-message\\"><i aria-label=\\"icon: exclamation-circle\\" class=\\"anticon anticon-exclamation-circle\\"><svg viewBox=\\"64 64 896 896\\" class=\\"\\" data-icon=\\"exclamation-circle\\" width=\\"1em\\" height=\\"1em\\" fill=\\"currentColor\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z\\"></path></svg></i><div class=\\"ant-popover-message-title\\">code</div></div><div class=\\"ant-popover-buttons\\"><button type=\\"button\\" class=\\"ant-btn ant-btn-sm\\"><span>Cancel</span></button><button type=\\"button\\" class=\\"ant-btn ant-btn-primary ant-btn-sm\\"><span>OK</span></button></div></div></div></div></div>"`;

14
components/progress/__tests__/__snapshots__/demo.test.js.snap

@ -88,6 +88,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -145,6 +146,7 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
class=""
data-icon="check"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -219,6 +221,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
class=""
data-icon="minus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -242,6 +245,7 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
class=""
data-icon="plus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -347,6 +351,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -404,6 +409,7 @@ exports[`renders ./components/progress/demo/circle-mini.md correctly 1`] = `
class=""
data-icon="check"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -505,6 +511,7 @@ exports[`renders ./components/progress/demo/dynamic.md correctly 1`] = `
class=""
data-icon="minus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -528,6 +535,7 @@ exports[`renders ./components/progress/demo/dynamic.md correctly 1`] = `
class=""
data-icon="plus"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -635,7 +643,7 @@ exports[`renders ./components/progress/demo/format.md correctly 1`] = `
exports[`renders ./components/progress/demo/gradient-line.md correctly 1`] = `
<div>
<div
class="ant-progress ant-progress-line ant-progress-status-active ant-progress-show-info ant-progress-default"
class="ant-progress ant-progress-line ant-progress-status-normal ant-progress-show-info ant-progress-default"
>
<div>
<div
@ -763,6 +771,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -803,6 +812,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -916,6 +926,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
class=""
data-icon="close-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -956,6 +967,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

2
components/progress/__tests__/__snapshots__/index.test.js.snap

@ -145,6 +145,7 @@ exports[`Progress render out-of-range progress 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -188,6 +189,7 @@ exports[`Progress render out-of-range progress with info 1`] = `
class=""
data-icon="check-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

19
components/progress/__tests__/index.test.js

@ -86,4 +86,23 @@ describe('Progress', () => {
'test10 10%, test20 20%, test30 30%',
);
});
it('should show success status when percent is 100', () => {
const wrapper = mount(<Progress percent={100} />);
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(1);
});
// https://github.com/ant-design/ant-design/issues/15950
it('should show success status when percent is 100 and status is undefined', () => {
const wrapper = mount(<Progress percent={100} status={undefined} />);
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(1);
});
// https://github.com/ant-design/ant-design/pull/15951#discussion_r273062969
it('should show success status when status is invalid', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const wrapper = mount(<Progress percent={100} status="invalid" />);
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(1);
errorSpy.mockRestore();
});
});

1
components/progress/demo/gradient-line.md

@ -24,7 +24,6 @@ const Demo = () => (
'100%': '#87d068',
}}
percent={99.9}
status="active"
/>
<Progress
strokeColor={{

26
components/progress/progress.tsx

@ -61,6 +61,22 @@ export default class Progress extends React.Component<ProgressProps> {
default: PropTypes.oneOf(['default', 'small']),
};
getPercentNumber() {
const { successPercent, percent = 0 } = this.props;
return parseInt(
successPercent !== undefined ? successPercent.toString() : percent.toString(),
10,
);
}
getProgressStatus() {
const { status } = this.props;
if (ProgressStatuses.indexOf(status!) < 0 && this.getPercentNumber() >= 100) {
return 'success';
}
return status || 'normal';
}
renderProcessInfo(prefixCls: string, progressStatus: (typeof ProgressStatuses)[number]) {
const { showInfo, format, type, percent, successPercent } = this.props;
if (!showInfo) return null;
@ -104,15 +120,9 @@ export default class Progress extends React.Component<ProgressProps> {
...restProps
} = props;
const prefixCls = getPrefixCls('progress', customizePrefixCls);
const progressStatus =
parseInt(successPercent !== undefined ? successPercent.toString() : percent.toString(), 10) >=
100 && !('status' in props)
? 'success'
: status || 'normal';
let progress;
const progressStatus = this.getProgressStatus();
const progressInfo = this.renderProcessInfo(prefixCls, progressStatus);
let progress;
// Render progress shape
if (type === 'line') {
progress = (

70
components/rate/__tests__/__snapshots__/demo.test.js.snap

@ -28,6 +28,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -50,6 +51,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -84,6 +86,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -106,6 +109,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -140,6 +144,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -162,6 +167,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -196,6 +202,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -218,6 +225,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -252,6 +260,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -274,6 +283,7 @@ exports[`renders ./components/rate/demo/basic.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -318,6 +328,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -340,6 +351,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -374,6 +386,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -396,6 +409,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -430,6 +444,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -452,6 +467,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -486,6 +502,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -508,6 +525,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -542,6 +560,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -564,6 +583,7 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
class=""
data-icon="heart"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -844,6 +864,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -866,6 +887,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -900,6 +922,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -922,6 +945,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -956,6 +980,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -978,6 +1003,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1012,6 +1038,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1034,6 +1061,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1068,6 +1096,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1090,6 +1119,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1132,6 +1162,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1154,6 +1185,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1188,6 +1220,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1210,6 +1243,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1244,6 +1278,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1266,6 +1301,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1300,6 +1336,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1322,6 +1359,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1356,6 +1394,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1378,6 +1417,7 @@ exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1423,6 +1463,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1445,6 +1486,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1479,6 +1521,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1501,6 +1544,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1535,6 +1579,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1557,6 +1602,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1591,6 +1637,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1613,6 +1660,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1647,6 +1695,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1669,6 +1718,7 @@ exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1712,6 +1762,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1734,6 +1785,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1768,6 +1820,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1790,6 +1843,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1824,6 +1878,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1846,6 +1901,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1880,6 +1936,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1902,6 +1959,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1936,6 +1994,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1958,6 +2017,7 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2002,6 +2062,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2024,6 +2085,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2058,6 +2120,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2080,6 +2143,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2114,6 +2178,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2136,6 +2201,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2170,6 +2236,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2192,6 +2259,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2226,6 +2294,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -2248,6 +2317,7 @@ exports[`renders ./components/rate/demo/text.md correctly 1`] = `
class=""
data-icon="star"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

18
components/select/__tests__/__snapshots__/demo.test.js.snap

@ -83,6 +83,7 @@ exports[`renders ./components/select/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -134,6 +135,7 @@ exports[`renders ./components/select/demo/basic.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -185,6 +187,7 @@ exports[`renders ./components/select/demo/basic.md correctly 1`] = `
class="anticon-spin"
data-icon="loading"
fill="currentColor"
focusable="false"
height="1em"
viewBox="0 0 1024 1024"
width="1em"
@ -241,6 +244,7 @@ exports[`renders ./components/select/demo/coordinate.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -292,6 +296,7 @@ exports[`renders ./components/select/demo/coordinate.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -347,6 +352,7 @@ exports[`renders ./components/select/demo/custom-dropdown-menu.md correctly 1`]
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -450,6 +456,7 @@ exports[`renders ./components/select/demo/label-in-value.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -513,6 +520,7 @@ exports[`renders ./components/select/demo/multiple.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -548,6 +556,7 @@ exports[`renders ./components/select/demo/multiple.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -623,6 +632,7 @@ exports[`renders ./components/select/demo/optgroup.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -696,6 +706,7 @@ exports[`renders ./components/select/demo/search.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -913,6 +924,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
class=""
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -974,6 +986,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1009,6 +1022,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1091,6 +1105,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1126,6 +1141,7 @@ exports[`renders ./components/select/demo/size.md correctly 1`] = `
class=""
data-icon="close"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1203,6 +1219,7 @@ exports[`renders ./components/select/demo/suffix.md correctly 1`] = `
class=""
data-icon="smile"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
@ -1254,6 +1271,7 @@ exports[`renders ./components/select/demo/suffix.md correctly 1`] = `
class=""
data-icon="meh"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save