diff --git a/.eslintrc.js b/.eslintrc.js index ae73dba07..5a7680725 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,7 @@ const eslintrc = { env: { browser: true, node: true, - mocha: true, + jasmine: true, jest: true, es6: true, }, diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 63242f168..82f730dc3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -1,14 +1,32 @@ --- -order: 9 +order: 6 title: Change Log toc: false timeline: true --- -If you want to read change logs before `2.0.0`, please visit [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0). + +`antd` strictly follows [Semantic Versioning 2.0.0](http://semver.org/). + +If you want to read change logs before `2.0.0`, please visit [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md). --- +## 2.6.4 + +`2017-01-20` + +* Improve RangePicker when selecting a preset date.[#4561](https://github.com/ant-design/ant-design/issues/4561) +* Fix DatePicker select time scroll issue.[#4412](https://github.com/ant-design/ant-design/issues/4412) +* Fix issue resulting in vertical Menu can't be controlled.[#3783](https://github.com/ant-design/ant-design/issues/3783) +* Fix Cascader's style when it's disabled.[#4648](https://github.com/ant-design/ant-design/issues/4648) +* Table + * Improve Table fixed header's scrollbar style.[#4637](https://github.com/ant-design/ant-design/issues/4637) + * Fix issue resulting in Table's header flashes when `loading` is true in Safari.[#4622](https://github.com/ant-design/ant-design/issues/4622) + * Fix multiple border issues. [#4647](https://github.com/ant-design/ant-design/issues/4647)、[#4635](https://github.com/ant-design/ant-design/issues/4635) + * Fix `showHeader`'s default value.[#4658](https://github.com/ant-design/ant-design/issues/4658) + * Fix missing `TableColumnConfig` type.[#4660](https://github.com/ant-design/ant-design/issues/4660) + ## 2.6.3 `2017-01-15` diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index db944b3ed..334f7921f 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -1,14 +1,31 @@ --- -order: 9 +order: 6 title: 更新日志 toc: false timeline: true --- -如果需要查看 `2.0.0` 之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/releases?after=2.0.0)。 +`antd` 严格遵循 [Semantic Versioning 2.0.0](http://semver.org/lang/zh-CN/) 语义化版本规范。 + +如果需要查看 `2.0.0` 之前的更新日志,请移步 [GitHub](https://github.com/ant-design/ant-design/blob/1.x-stable/CHANGELOG.md)。 --- +## 2.6.4 + +`2017-01-20` + +* 优化 RangePicker 选择预设时间时的界面显示。[#4561](https://github.com/ant-design/ant-design/issues/4561) +* 修复 DatePicker 选择时间界面的滚动问题。[#4412](https://github.com/ant-design/ant-design/issues/4412) +* 修复 Menu 在 `vertical` 的受控模式下,子菜单不会弹出的问题。[#3783](https://github.com/ant-design/ant-design/issues/3783) +* 修复 Cascader 禁用时的值显示样式问题。[#4648](https://github.com/ant-design/ant-design/issues/4648) +* Table + * 优化固定表头的滚动条显示。[#4637](https://github.com/ant-design/ant-design/issues/4637) + * 修复在 Safari 下显示 loading 效果时表头会闪烁的问题。[#4622](https://github.com/ant-design/ant-design/issues/4622) + * 修复多处边框问题。[#4647](https://github.com/ant-design/ant-design/issues/4647)、[#4635](https://github.com/ant-design/ant-design/issues/4635) + * 修复 showHeader 的默认值不为 `false` 的问题。[#4658](https://github.com/ant-design/ant-design/issues/4658) + * 修复找不到 `TableColumnConfig` 的类型定义的问题。[#4660](https://github.com/ant-design/ant-design/issues/4660) + ## 2.6.3 `2017-01-15` diff --git a/README-zh_CN.md b/README-zh_CN.md index 775cbee05..e3d4fa362 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -21,8 +21,8 @@ ## 特性 -- 提炼和服务企业级中后台产品的交互语言和视觉风格。 -- [React Component](http://react-component.github.io/badgeboard/) 基础上精心封装的高质量 UI 组件。 +- 提炼自企业级中后台产品的交互语言和视觉风格。 +- 开箱即用的高质量 React 组件。 - 使用 TypeScript 构建,提供完整的类型定义文件。 - 基于 npm + webpack + [dva](https://github.com/dvajs/dva) 的企业级开发框架。 diff --git a/README.md b/README.md index 02414de25..36ed98e5b 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ An enterprise-class UI design language and React-based implementation. ## Features -- An enterprise-class design language and high quality UI. -- Graceful UI components out of the box, based on [React Component](http://react-component.github.io/badgeboard/). +- An enterprise-class UI design language for web applications. +- A set of high-quality React components out of the box. - Written in TypeScript with complete define types. - A npm + webpack + [dva](https://github.com/dvajs/dva) front-end development workflow. diff --git a/components/_util/getRequestAnimationFrame.tsx b/components/_util/getRequestAnimationFrame.tsx index f75c84e28..a92a5ab2e 100644 --- a/components/_util/getRequestAnimationFrame.tsx +++ b/components/_util/getRequestAnimationFrame.tsx @@ -1,3 +1,14 @@ +function requestAnimationFramePolyfill() { + let lastTime = 0; + return function(callback) { + const currTime = new Date().getTime(); + const timeToCall = Math.max(0, 16 - (currTime - lastTime)); + const id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall); + lastTime = currTime + timeToCall; + return id; + }; +} + export default function getRequestAnimationFrame() { if (typeof window === 'undefined') { return () => {}; @@ -8,5 +19,5 @@ export default function getRequestAnimationFrame() { const prefix = ['moz', 'ms', 'webkit'].filter(key => `${key}RequestAnimationFrame` in window)[0]; return prefix ? window[`${prefix}RequestAnimationFrame`] - : callback => setTimeout(callback, 1000 / 60); + : requestAnimationFramePolyfill(); } diff --git a/components/_util/throttleByAnimationFrame.tsx b/components/_util/throttleByAnimationFrame.tsx new file mode 100644 index 000000000..f0afd147a --- /dev/null +++ b/components/_util/throttleByAnimationFrame.tsx @@ -0,0 +1,42 @@ +import getRequestAnimationFrame from '../_util/getRequestAnimationFrame'; + +const reqAnimFrame = getRequestAnimationFrame(); + +export default function throttleByAnimationFrame(fn, threshhold = 250) { + let last; + return function() { + const self = this; + const args = arguments; + reqAnimFrame(timestamp => { + if (!last || timestamp - last > threshhold) { + last = timestamp; + fn.apply(self, args); + } + }); + }; +} + +export function throttleByAnimationFrameDecorator(threshhold = 250) { + return function(target, key, descriptor) { + let fn = descriptor.value; + let definingProperty = false; + return { + configurable: true, + get() { + if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) { + return fn; + } + + let boundFn = throttleByAnimationFrame(fn.bind(this), threshhold); + definingProperty = true; + Object.defineProperty(this, key, { + value: boundFn, + configurable: true, + writable: true, + }); + definingProperty = false; + return boundFn; + }, + }; + }; +} diff --git a/components/affix/index.en-US.md b/components/affix/index.en-US.md index 6bed2669d..202962a70 100644 --- a/components/affix/index.en-US.md +++ b/components/affix/index.en-US.md @@ -16,8 +16,8 @@ Please note that Affix should not cover other content on the page, especially wh | Property | Description | Type | Default | |--------------|-----------------------|----------|--------------| -| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 | -| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - | +| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | +| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - | | onChange | Callback when affix state is changed | Function(affixed) | - | **Note:** Children of `Affix` can not be `position: absolute`, but you can set `Affix` as `position: absolute`: diff --git a/components/affix/index.tsx b/components/affix/index.tsx index 15a0e728b..2a26d5876 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -5,6 +5,7 @@ import classNames from 'classnames'; import shallowequal from 'shallowequal'; import omit from 'omit.js'; import getScroll from '../_util/getScroll'; +import { throttleByAnimationFrameDecorator } from '../_util/throttleByAnimationFrame'; function getTargetRect(target): ClientRect { return target !== window ? @@ -96,18 +97,16 @@ export default class Affix extends React.Component { }); } - setPlaceholderStyle(e, placeholderStyle) { + setPlaceholderStyle(placeholderStyle) { const originalPlaceholderStyle = this.state.placeholderStyle; - if (e.type === 'resize') { - return; - } if (shallowequal(placeholderStyle, originalPlaceholderStyle)) { return; } this.setState({ placeholderStyle }); } - updatePosition = (e) => { + @throttleByAnimationFrameDecorator(250) + updatePosition(e) { let { offsetTop, offsetBottom, offset, target = getDefaultTarget } = this.props; const targetNode = target(); @@ -145,7 +144,7 @@ export default class Affix extends React.Component { left: targetRect.left + elemOffset.left, width: affixNode.offsetWidth, }); - this.setPlaceholderStyle(e, { + this.setPlaceholderStyle({ width: affixNode.offsetWidth, height: affixNode.offsetHeight, }); @@ -161,13 +160,18 @@ export default class Affix extends React.Component { left: targetRect.left + elemOffset.left, width: affixNode.offsetWidth, }); - this.setPlaceholderStyle(e, { + this.setPlaceholderStyle({ width: affixNode.offsetWidth, height: affixNode.offsetHeight, }); } else { - this.setAffixStyle(e, null); - this.setPlaceholderStyle(e, null); + const { affixStyle } = this.state; + if (e.type === 'resize' && affixStyle && affixStyle.position === 'fixed' && affixNode.offsetWidth) { + this.setAffixStyle(e, {...affixStyle, width: affixNode.offsetWidth }); + } else { + this.setAffixStyle(e, null); + } + this.setPlaceholderStyle(null); } } @@ -217,9 +221,9 @@ export default class Affix extends React.Component { }); const props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target']); - + const placeholderStyle = { ...this.state.placeholderStyle, ...this.props.style }; return ( -
+
{this.props.children}
diff --git a/components/affix/index.zh-CN.md b/components/affix/index.zh-CN.md index 1248efc39..7c1582c9a 100644 --- a/components/affix/index.zh-CN.md +++ b/components/affix/index.zh-CN.md @@ -17,8 +17,8 @@ title: Affix | 成员 | 说明 | 类型 | 默认值 | |-------------|----------------|--------------------|--------------| -| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | | -| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | | +| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | +| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | | | target | 设置 `Affix` 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 | Function | () => window | | onChange | 固定状态改变时触发的回调函数 | Function(affixed) | 无 | diff --git a/components/alert/index.en-US.md b/components/alert/index.en-US.md index bcabca5cb..8e9986453 100644 --- a/components/alert/index.en-US.md +++ b/components/alert/index.en-US.md @@ -15,11 +15,11 @@ Alert component for feedback. | Property | Description | Type | Default | |----------- |--------------------------------------------------------- | ---------- |-------| -| type | Type of Alert styles, options:`success`, `info`, `warning`, `error` | String | `info` | -| closable | Whether Alert can be closed | Boolean | - | -| closeText | Close text to show | React.Node | - | -| message | Content of Alert | React.Node | - | -| description | Additional content of Alert | React.Node | - | +| type | Type of Alert styles, options:`success`, `info`, `warning`, `error` | string | `info` | +| closable | Whether Alert can be closed | boolean | - | +| closeText | Close text to show | string\|ReactNode | - | +| message | Content of Alert | string\|ReactNode | - | +| description | Additional content of Alert | string\|ReactNode | - | | onClose | Callback when close Alert | Function | - | -| showIcon | Whether to show icon | Boolean | false | -| banner | Whether to show as banner | Boolean | false | +| showIcon | Whether to show icon | boolean | false | +| banner | Whether to show as banner | boolean | false | diff --git a/components/alert/index.zh-CN.md b/components/alert/index.zh-CN.md index 9bf91f7e6..d9f5e0f0a 100644 --- a/components/alert/index.zh-CN.md +++ b/components/alert/index.zh-CN.md @@ -16,12 +16,12 @@ title: Alert | 参数 | 说明 | 类型 | 默认值 | |----------- |--------------------------------------------------------- | ---------- |-------| -| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | String | `info` | -| closable | 默认不显示关闭按钮 | Boolean | 无 | -| closeText | 自定义关闭按钮 | React.Node | 无 | -| message | 警告提示内容 | React.Node | 无 | -| description | 警告提示的辅助性文字介绍 | React.Node | 无 | +| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info` | +| closable | 默认不显示关闭按钮 | boolean | 无 | +| closeText | 自定义关闭按钮 | string\|ReactNode | 无 | +| message | 警告提示内容 | string\|ReactNode | 无 | +| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 | | onClose | 关闭时触发的回调函数 | Function | 无 | -| showIcon | 是否显示辅助图标 | Boolean | false | -| banner | 是否用作顶部公告 | Boolean | false | +| showIcon | 是否显示辅助图标 | boolean | false | +| banner | 是否用作顶部公告 | boolean | false | diff --git a/components/anchor/AnchorLink.tsx b/components/anchor/AnchorLink.tsx index 3c5a513ff..df94e9aab 100644 --- a/components/anchor/AnchorLink.tsx +++ b/components/anchor/AnchorLink.tsx @@ -8,7 +8,7 @@ export interface AnchorLinkProps { active?: boolean; prefixCls?: string; children?: any; - title?: Element; + title?: React.ReactNode; bounds: number; target?: () => HTMLElement | Window; affix?: boolean; diff --git a/components/anchor/index.en-US.md b/components/anchor/index.en-US.md index fadf07ced..78ebcf8b8 100644 --- a/components/anchor/index.en-US.md +++ b/components/anchor/index.en-US.md @@ -17,13 +17,13 @@ For displaying anchor hyperlinks on page and jumping between them. | Property | Description | Type | Default | |--------------|-----------------------|----------|--------------| -| offsetTop | Pixels to offset from top when calculating position of scroll | Number | 0 | -| offsetBottom | Pixels to offset from bottom when calculating position of scroll | Number | - | -| bounds | Bounding distance of anchor area | Number | 5(px) | +| offsetTop | Pixels to offset from top when calculating position of scroll | number | 0 | +| offsetBottom | Pixels to offset from bottom when calculating position of scroll | number | - | +| bounds | Bounding distance of anchor area | number | 5(px) | ### Link Props | Property | Description | Type | Default | |-------------|----------------|--------------------|--------------| -| href | target of hyperlink | String | | -| title | content of hyperlink | React.Node | | +| href | target of hyperlink | string | | +| title | content of hyperlink | string\|ReactNode | | diff --git a/components/anchor/index.zh-CN.md b/components/anchor/index.zh-CN.md index c4d0fb51a..5b7441422 100644 --- a/components/anchor/index.zh-CN.md +++ b/components/anchor/index.zh-CN.md @@ -18,13 +18,13 @@ title: Anchor | 成员 | 说明 | 类型 | 默认值 | |-------------|----------------|--------------------|--------------| -| offsetTop | 距离窗口顶部达到指定偏移量后触发 | Number | | -| offsetBottom | 距离窗口底部达到指定偏移量后触发 | Number | | -| bounds | 锚点区域边界 | Number | 5(px) | +| offsetTop | 距离窗口顶部达到指定偏移量后触发 | number | | +| offsetBottom | 距离窗口底部达到指定偏移量后触发 | number | | +| bounds | 锚点区域边界 | number | 5(px) | ### Link Props | 成员 | 说明 | 类型 | 默认值 | |-------------|----------------|--------------------|--------------| -| href | 锚点链接 | String | | -| title | 文字内容 | React.Node | | +| href | 锚点链接 | string | | +| title | 文字内容 | string\|ReactNode | | diff --git a/components/auto-complete/index.en-US.md b/components/auto-complete/index.en-US.md index 2b4f3cb9b..84fbf7f6d 100644 --- a/components/auto-complete/index.en-US.md +++ b/components/auto-complete/index.en-US.md @@ -21,9 +21,9 @@ Since `AutoComplete` is based on `Select`, so besides the following API, `AutoCo | Property | Description | Type | Default | |----------------|----------------------------------|------------|--------| -| dataSource | Data source for autocomplete | Array | | -| value | selected option | String/Array/{key: String, label: React.Node}/Array<{key, label}> | - | -| defaultValue | Initial selected option. | string/Array | - | +| dataSource | Data source for autocomplete | [DataSourceItemType](https://git.io/vMMKF)[] | | +| value | selected option | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - | +| defaultValue | Initial selected option. | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | - | | allowClear | Show clear button, effective in multiple mode only. | boolean | false | | onChange | Called when select an option or input value change, or value of input is changed | function(value, label) | - | | onSelect | Called when a option is selected. param is option's value and option instance. | function(value, option) | - | diff --git a/components/auto-complete/index.zh-CN.md b/components/auto-complete/index.zh-CN.md index 0a4b44baf..4b3b4af1e 100644 --- a/components/auto-complete/index.zh-CN.md +++ b/components/auto-complete/index.zh-CN.md @@ -22,9 +22,9 @@ const dataSource = ['12345', '23456', '34567']; | 参数 | 说明 | 类型 | 默认值 | |----------------|----------------------------------|------------|---------| -| dataSource | 自动完成的数据源 | Array | | -| value | 指定当前选中的条目 | String/Array/{key: String, label: React.Node}/Array<{key, label}> | 无 | -| defaultValue | 指定默认选中的条目 | String/Array/{key: String, label: React.Node}/Array<{key, label}> | 无 | +| dataSource | 自动完成的数据源 | [DataSourceItemType](https://git.io/vMMKF)[] | | +| value | 指定当前选中的条目 | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode }> | 无 | +| defaultValue | 指定默认选中的条目 | string\|string[]\|{ key: string, label: string\|ReactNode }\|Array<{ key: string, label: string\|ReactNode}> | 无 | | allowClear | 支持清除, 单选模式有效 | boolean | false | | onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 | | onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 | diff --git a/components/back-top/index.en-US.md b/components/back-top/index.en-US.md index 0c04f4161..9d3874d17 100644 --- a/components/back-top/index.en-US.md +++ b/components/back-top/index.en-US.md @@ -20,6 +20,6 @@ title: BackTop Property | Description | Type | Default -----|-----|-----|------ -visibilityHeight | the `BackTop` button will not show until the scroll height reaches this value | Number | 400 +visibilityHeight | the `BackTop` button will not show until the scroll height reaches this value | number | 400 onClick | a callback function, which can be executed when you click the button | Function | - diff --git a/components/back-top/index.zh-CN.md b/components/back-top/index.zh-CN.md index f6dc13920..2d227ca44 100644 --- a/components/back-top/index.zh-CN.md +++ b/components/back-top/index.zh-CN.md @@ -20,5 +20,5 @@ title: BackTop | 参数 | 说明 | 类型 | 默认值 | |-------------|----------------|--------------------|--------------| -| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | Number | 400 | +| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | number | 400 | | onClick | 点击按钮的回调函数 | Function | - | diff --git a/components/badge/index.en-US.md b/components/badge/index.en-US.md index 9385059bc..2ec2c7637 100644 --- a/components/badge/index.en-US.md +++ b/components/badge/index.en-US.md @@ -25,8 +25,8 @@ Badge normally appears in proximity to notification or head picture with eye-cat | Property | Description | Type | Default | |----------------|-------------------------|------------|---------| -| count | Number to show in badge | Number | | -| overflowCount | Max count to show | Number | 99 | -| dot | Whether to show red dot without number | Boolean | false | +| count | Number to show in badge | number | | +| overflowCount | Max count to show | number | 99 | +| dot | Whether to show red dot without number | boolean | false | | status | Set Badge as a status dot | Enum{ 'success', 'processing, 'default', 'error', 'warning' } | '' | -| text | If `status` is set, `text` is to set the text of status dot | String | '' | +| text | If `status` is set, `text` is to set the text of status dot | string | '' | diff --git a/components/badge/index.zh-CN.md b/components/badge/index.zh-CN.md index 27eb3986a..41a8a4fe6 100644 --- a/components/badge/index.zh-CN.md +++ b/components/badge/index.zh-CN.md @@ -26,8 +26,8 @@ title: Badge | 参数 | 说明 | 类型 | 可选值 | 默认值 | |----------------|----------------------------------|------------|---------|--------| -| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | Number | | | -| overflowCount | 展示封顶的数字值 | Number | | 99 | -| dot | 不展示数字,只有一个小红点 | Boolean | | false | +| count | 展示的数字,大于 overflowCount 时显示为 `${overflowCount}+`,为 0 时隐藏 | number | | | +| overflowCount | 展示封顶的数字值 | number | | 99 | +| dot | 不展示数字,只有一个小红点 | boolean | | false | | status | 设置 Badge 为状态点 | Enum | 'success'、'processing'、'default'、'error'、'warning' | '' | -| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | String | | '' | +| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | | '' | diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 198134967..e19e72fec 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -8,7 +8,7 @@ export interface BreadcrumbProps { prefixCls?: string; routes?: Array; params?: Object; - separator?: string | React.ReactNode; + separator?: React.ReactNode; itemRender?: (route: any, params: any, routes: Array, paths: Array) => React.ReactNode; style?: React.CSSProperties; className?: string; @@ -44,10 +44,7 @@ export default class Breadcrumb extends React.Component { static propTypes = { prefixCls: React.PropTypes.string, - separator: React.PropTypes.oneOfType([ - React.PropTypes.string, - React.PropTypes.element, - ]), + separator: React.PropTypes.node, routes: React.PropTypes.array, params: React.PropTypes.object, linkRender: React.PropTypes.func, @@ -92,8 +89,8 @@ export default class Breadcrumb extends React.Component { } else if (children) { crumbs = React.Children.map(children, (element: any, index) => { warning( - element.type === BreadcrumbItem, - ' `BreadcrumbItem` is required as the wrapper of children element. ' + element && element.type.__ANT_BREADCRUMB_ITEM, + 'Breadcrumb only accetps Breadcrumb.Item as it\'s children' ); return cloneElement(element, { separator, diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index 02b4c4f0d..b1ec47ebd 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -8,6 +8,8 @@ export interface BreadcrumbItemProps { } export default class BreadcrumbItem extends React.Component { + static __ANT_BREADCRUMB_ITEM = true; + static defaultProps = { prefixCls: 'ant-breadcrumb', separator: '/', diff --git a/components/breadcrumb/__tests__/Breadcrumb.test.js b/components/breadcrumb/__tests__/Breadcrumb.test.js new file mode 100644 index 000000000..a1e48d54c --- /dev/null +++ b/components/breadcrumb/__tests__/Breadcrumb.test.js @@ -0,0 +1,19 @@ +import React from 'react'; +import { mount } from 'enzyme'; +import Breadcrumb from '../Breadcrumb'; + +describe('Breadcrumb', () => { + it('warns on non-Breadcrumb.Item children', () => { + const MyCom = () =>
foo
; + spyOn(console, 'error'); + mount( + + + + ); + expect(console.error.calls.count()).toBe(1); + expect(console.error.calls.argsFor(0)[0]).toContain( + 'Breadcrumb only accetps Breadcrumb.Item as it\'s children' + ); + }); +}); diff --git a/components/breadcrumb/index.en-US.md b/components/breadcrumb/index.en-US.md index b318b4fd8..46ac3f498 100644 --- a/components/breadcrumb/index.en-US.md +++ b/components/breadcrumb/index.en-US.md @@ -17,10 +17,10 @@ A breadcrumb displays the current location within a hierarchy. It allows going b | Property | Description | Type | Optional | Default | |-----------|-----------------------------------|-----------------|---------|--------| -| routes | The routing stack information of router | Array | | - | -| params | Routing parameter | Object | | - | -| separator | Custom separator | String or Element | | '/' | -| itemRender | Custom item renderer | (route, params, routes, paths) => React.ReactNode | | - | +| routes | The routing stack information of router | object[] | | - | +| params | Routing parameter | object | | - | +| separator | Custom separator | string\|ReactNode | | '/' | +| itemRender | Custom item renderer | (route, params, routes, paths) => ReactNode | | - | > `linkRender` and `nameRender` were removed after `antd@2.0`, please use `itemRender` instead. diff --git a/components/breadcrumb/index.zh-CN.md b/components/breadcrumb/index.zh-CN.md index f8248f714..28e7bafec 100644 --- a/components/breadcrumb/index.zh-CN.md +++ b/components/breadcrumb/index.zh-CN.md @@ -17,10 +17,10 @@ title: Breadcrumb | 参数 | 说明 | 类型 | 可选值 | 默认值 | |-----------|-----------------------------------|-----------------|---------|--------| -| routes | router 的路由栈信息 | Array | | - | -| params | 路由的参数 | Object | | - | -| separator | 分隔符自定义 | String or Element | | '/' | -| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => React.ReactNode | | - | +| routes | router 的路由栈信息 | object[] | | - | +| params | 路由的参数 | object | | - | +| separator | 分隔符自定义 | string\|ReactNode | | '/' | +| itemRender | 自定义链接函数,和 react-router 配置使用 | (route, params, routes, paths) => ReactNode | | - | > 2.0 之后,`linkRender` 和 `nameRender` 被移除,请使用 `itemRender` 来代替。 diff --git a/components/button/index.en-US.md b/components/button/index.en-US.md index 9338528f7..6316b3fd0 100644 --- a/components/button/index.en-US.md +++ b/components/button/index.en-US.md @@ -21,7 +21,7 @@ htmlType | to set the original `type` of `button`, see: [MDN](https://developer. icon | set the icon of button, see: Icon component | string | - shape | can be set to `circle` or omitted | string | - size | can be set to `small` `large` or omitted | string | `default` -loading | to set the loading status of button | boolean | false +loading | to set the loading status of button | boolean | `false` onClick | set the handler to handle `click` event | function | - ghost | make background transparent and invert text and border color, added in 2.7 | boolean | false diff --git a/components/button/index.zh-CN.md b/components/button/index.zh-CN.md index ec161e885..07bc87578 100644 --- a/components/button/index.zh-CN.md +++ b/components/button/index.zh-CN.md @@ -24,7 +24,7 @@ htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标 icon | 设置按钮的图标类型 | string | - shape | 设置按钮形状,可选值为 `circle` 或者不设 | string | - size | 设置按钮大小,可选值为 `small` `large` 或者不设 | string | `default` -loading | 设置按钮载入状态 | boolean | false +loading | 设置按钮载入状态 | boolean | `false` onClick | `click` 事件的 handler | function | - ghost | 幽灵属性,使按钮背景透明,版本 2.7 中增加 | boolean | false diff --git a/components/calendar/index.en-US.md b/components/calendar/index.en-US.md index d64c71119..73e720a67 100644 --- a/components/calendar/index.en-US.md +++ b/components/calendar/index.en-US.md @@ -29,5 +29,5 @@ When data is in the form of date, such as schedule, timetable, prices calendar, | fullscreen | to set whether full-screen display | boolean | true | | dateCellRender | to set the way of renderer the date cell | function(date: moment): ReactNode | - | | monthCellRender | to set the way of renderer the month cell | function(date: moment): ReactNode | - | -| locale | set locale | Object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | +| locale | set locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | onPanelChange| the callback when panel change | function(date: moment, mode: string) | - | diff --git a/components/calendar/index.zh-CN.md b/components/calendar/index.zh-CN.md index 2df4ef480..2c1022125 100644 --- a/components/calendar/index.zh-CN.md +++ b/components/calendar/index.zh-CN.md @@ -31,5 +31,5 @@ title: Calendar | fullscreen | 是否全屏显示 | boolean | true | | dateCellRender | 自定义渲染日期单元格| function(date: moment): ReactNode | 无 | | monthCellRender | 自定义渲染月单元格 | function(date: moment): ReactNode | 无 | -| locale | 国际化配置 | Object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | +| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | onPanelChange| 日期面板变化回调 | function(date: moment, mode: string) | 无 | diff --git a/components/card/index.en-US.md b/components/card/index.en-US.md index d40391c00..30e8a3072 100644 --- a/components/card/index.en-US.md +++ b/components/card/index.en-US.md @@ -19,7 +19,7 @@ A card can be used to display content related to a single subject. The content c | Property | Description | Type | Default | |----------|----------------|----------|--------------| -| title | Card title | React.Element | - | -| extra | Content to render in the top-right corner of the card | React.Element | - | -| bordered | Toggles rendering of the border around the card | Boolean | true | -| bodyStyle | Inline style to apply to the card content | Object | - | +| title | Card title | string\|ReactNode | - | +| extra | Content to render in the top-right corner of the card | string\|ReactNode | - | +| bordered | Toggles rendering of the border around the card | boolean | true | +| bodyStyle | Inline style to apply to the card content | object | - | diff --git a/components/card/index.zh-CN.md b/components/card/index.zh-CN.md index 4b1a8f4df..e6877ce27 100644 --- a/components/card/index.zh-CN.md +++ b/components/card/index.zh-CN.md @@ -20,7 +20,7 @@ cols: 1 | 参数 | 说明 | 类型 | 默认值 | |----------|----------------|----------|--------------| -| title | 卡片标题 | React.Element | - | -| extra | 卡片右上角的操作区域 | React.Element | - | -| bordered | 是否有边框 | Boolean | true | -| bodyStyle | 内容区域自定义样式 | Object | - | +| title | 卡片标题 | string\|ReactNode | - | +| extra | 卡片右上角的操作区域 | string\|ReactNode | - | +| bordered | 是否有边框 | boolean | true | +| bodyStyle | 内容区域自定义样式 | object | - | diff --git a/components/carousel/index.en-US.md b/components/carousel/index.en-US.md index 0cfb09606..abba45992 100644 --- a/components/carousel/index.en-US.md +++ b/components/carousel/index.en-US.md @@ -16,11 +16,11 @@ A carousel component. Scales with its container. | Property | Description | Type | Default | |------------------|----------------------------------------------|----------|---------------------------------| -| effect | Animation effect, either `scrollx` or `fade` | String | scrollx | -| dots | Whether to show the dots at the bottom of the gallery | Boolean | true | -| vertical | Whether to use a vertical display | Boolean | false | -| autoplay | Whether to scroll automatically | Boolean | false | -| easing | Transition name | String | linear | +| effect | Animation effect, either `scrollx` or `fade` | string | scrollx | +| dots | Whether to show the dots at the bottom of the gallery | boolean | true | +| vertical | Whether to use a vertical display | boolean | false | +| autoplay | Whether to scroll automatically | boolean | false | +| easing | Transition name | string | linear | | beforeChange | Callback function called before the current index changes | function(from, to) | | afterChange | Callback function called after the current index changes | function(current) | diff --git a/components/carousel/index.zh-CN.md b/components/carousel/index.zh-CN.md index e8db4547c..c369d4957 100644 --- a/components/carousel/index.zh-CN.md +++ b/components/carousel/index.zh-CN.md @@ -17,11 +17,11 @@ subtitle: 走马灯 | 参数 | 说明 | 类型 | 默认值 | |------------------|----------------------------------------------|----------|---------------------------------| -| effect | 动画效果函数,可取 scrollx, fade | String | scrollx | -| dots | 是否显示面板指示点 | Boolean | true | -| vertical | 垂直显示 | Boolean | false | -| autoplay | 是否自动切换 | Boolean | false | -| easing | 动画效果 | String | linear | +| effect | 动画效果函数,可取 scrollx, fade | string | scrollx | +| dots | 是否显示面板指示点 | boolean | true | +| vertical | 垂直显示 | boolean | false | +| autoplay | 是否自动切换 | boolean | false | +| easing | 动画效果 | string | linear | | beforeChange | 切换面板的回调 | function(from, to) | 无 | afterChange | 切换面板的回调 | function(current) | 无 diff --git a/components/cascader/index.en-US.md b/components/cascader/index.en-US.md index b48d1f718..af9f0aae8 100644 --- a/components/cascader/index.en-US.md +++ b/components/cascader/index.en-US.md @@ -22,10 +22,10 @@ Cascade selection box. | Property | Description | Type | Default | |------|------|------|--------| | options | data options of cascade | object | - | -| defaultValue | initial selected value | array |[] | -| value | selected value | array | - | +| defaultValue | initial selected value | [CascaderOptionType](https://git.io/vMMoK)[] |[] | +| value | selected value | [CascaderOptionType](https://git.io/vMMoK)[] | - | | onChange | callback when finishing cascader select | `(value, selectedOptions) => void` | - | -| displayRender | render function of displaying selected options | `(label, selectedOptions) => React.ReactNode` | `label => label.join(' / ')` | +| displayRender | render function of displaying selected options | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` | | style | additional style | string | - | | className | additional css class | string | - | | popupClassName | additional className of popup overlay | string | - | @@ -36,8 +36,8 @@ Cascade selection box. | allowClear | whether allow clear | boolean | true | | expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | 'click' | | changeOnSelect | change value on each selection if set to true, see above demo for details | boolean | false | -| showSearch | Whether show search input in single mode. | Boolean or Object | false | -| notFoundContent | Specify content to show when no result matches. | String | 'Not Found' | +| showSearch | Whether show search input in single mode. | boolean\|object | false | +| notFoundContent | Specify content to show when no result matches. | string | 'Not Found' | | loadData | To load option lazily, and it cannot work with `showSearch` | `(selectedOptions) => void` | - | | getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body | @@ -46,7 +46,7 @@ Fields in `showSearch`: | Property | Description | Type | Default | |----------|-------------|------|---------| | filter | The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded. | `function(inputValue, path): boolean` | | -| render | Used to render filtered options. | `function(inputValue, path): React.ReactNode` | | +| render | Used to render filtered options. | `function(inputValue, path): ReactNode` | | | sort | Used to sort filtered options. | `function(a, b, inputValue)` | | | matchInputWidth | Whether the width of result list equals to input's | boolean | | diff --git a/components/cascader/index.zh-CN.md b/components/cascader/index.zh-CN.md index 163aa938f..efd82ad12 100644 --- a/components/cascader/index.zh-CN.md +++ b/components/cascader/index.zh-CN.md @@ -22,23 +22,23 @@ subtitle: 级联选择 | 参数 | 说明 | 类型 | 默认值 | |------|------|------|--------| -| options | 可选项数据源 | Object | - | -| defaultValue | 默认的选中项 | Array |[] | -| value | 指定选中项 | Array | - | +| options | 可选项数据源 | object | - | +| defaultValue | 默认的选中项 | [CascaderOptionType](https://git.io/vMMoK)[] |[] | +| value | 指定选中项 | [CascaderOptionType](https://git.io/vMMoK)[] | - | | onChange | 选择完成后的回调 | `(value, selectedOptions) => void` | - | -| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => React.ReactNode` | `label => label.join(' / ')` | -| style | 自定义样式 | String | - | -| className | 自定义类名 | String | - | -| popupClassName | 自定义浮层类名 | String | - | +| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` | +| style | 自定义样式 | string | - | +| className | 自定义类名 | string | - | +| popupClassName | 自定义浮层类名 | string | - | | popupPlacement | 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` | Enum | `bottomLeft` | -| placeholder | 输入框占位文本 | String | '请选择' | -| size | 输入框大小,可选 `large` `default` `small` | String | `default` | -| disabled | 禁用 | Boolean | false | -| allowClear | 是否支持清除 | Boolean | true | -| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | String | 'click' | -| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | Boolean | false | -| showSearch | 在选择框中显示搜索框 | Boolean | false | -| notFoundContent | 当下拉列表为空时显示的内容 | String | 'Not Found' | +| placeholder | 输入框占位文本 | string | '请选择' | +| size | 输入框大小,可选 `large` `default` `small` | string | `default` | +| disabled | 禁用 | boolean | false | +| allowClear | 是否支持清除 | boolean | true | +| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | 'click' | +| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | boolean | false | +| showSearch | 在选择框中显示搜索框 | boolean | false | +| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' | | loadData | 用于动态加载选项,无法与 `showSearch` 一起使用 | `(selectedOptions) => void` | - | | getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/xVBOVQ?editors=001) | Function(triggerNode) | () => document.body | @@ -47,7 +47,7 @@ subtitle: 级联选择 | 参数 | 说明 | 类型 | 默认值 | |------|------|------|--------| | filter | 接收 `inputValue` `path` 两个参数,当 `path` 符合筛选条件时,应返回 true,反之则返回 false。 | `function(inputValue, path): boolean` | | -| render | 用于渲染 filter 后的选项 | `function(inputValue, path): React.ReactNode` | | +| render | 用于渲染 filter 后的选项 | `function(inputValue, path): ReactNode` | | | sort | 用于排序 filter 后的选项 | `function(a, b, inputValue)` | | | matchInputWidth | 搜索结果列表是否与输入框同宽 | boolean | | diff --git a/components/checkbox/index.en-US.md b/components/checkbox/index.en-US.md index 43b5a54a1..b92f556bb 100644 --- a/components/checkbox/index.en-US.md +++ b/components/checkbox/index.en-US.md @@ -17,15 +17,15 @@ Checkbox. | Property | Description | Type | Default | |----------|------------------|----------|--------| -| checked | Specifies whether the checkbox is selected. | Boolean | false | -| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | Boolean | false | +| checked | Specifies whether the checkbox is selected. | boolean | false | +| defaultChecked | Specifies the initial state: whether or not the checkbox is selected. | boolean | false | | onChange | The callback function that is triggered when the state changes. | Function(e:Event) | - | ### Checkbox Group | Property | Description | Type | Default | |----------|------------------|----------|--------| -| defaultValue | Default selected value | Array | [] | -| value | Used for setting the currently selected value. | Array | [] | -| options | Specifies options | Array | [] | +| defaultValue | Default selected value | string[] | [] | +| value | Used for setting the currently selected value. | string[] | [] | +| options | Specifies options | string[] | [] | | onChange | The callback function that is triggered when the state changes. | Function(checkedValue) | - | diff --git a/components/checkbox/index.zh-CN.md b/components/checkbox/index.zh-CN.md index 599230455..5346c6925 100644 --- a/components/checkbox/index.zh-CN.md +++ b/components/checkbox/index.zh-CN.md @@ -18,16 +18,16 @@ title: Checkbox | 参数 | 说明 | 类型 | 默认值 | |----------|------------------|----------|--------| -| checked | 指定当前是否选中 | Boolean | false | -| defaultChecked | 初始是否选中 | Boolean | false | +| checked | 指定当前是否选中 | boolean | false | +| defaultChecked | 初始是否选中 | boolean | false | | onChange | 变化时回调函数 | Function(e:Event) | - | -| indeterminate | 设置 indeterminate 状态,只负责样式控制 | Boolean | false | +| indeterminate | 设置 indeterminate 状态,只负责样式控制 | boolean | false | ### Checkbox Group | 参数 | 说明 | 类型 | 默认值 | |----------|------------------|----------|--------| -| defaultValue | 默认选中的选项 | Array | [] | -| value | 指定选中的选项| Array | [] | -| options | 指定可选项 | Array | [] | +| defaultValue | 默认选中的选项 | string[] | [] | +| value | 指定选中的选项| string[] | [] | +| options | 指定可选项 | string[] | [] | | onChange | 变化时回调函数 | Function(checkedValue) | - | diff --git a/components/collapse/index.en-US.md b/components/collapse/index.en-US.md index 2d0fa95d9..4b109e312 100644 --- a/components/collapse/index.en-US.md +++ b/components/collapse/index.en-US.md @@ -18,13 +18,13 @@ A content area which can be collapsed and expanded. | Property | Description | Type | Default | |----------|----------------|----------|--------------| -| activeKey | key of the active panel | Array or String | No default value. In `accordion` mode, it's the key of the first panel. | -| defaultActiveKey | key of the initialized active panel | String | - | +| activeKey | key of the active panel | string[]\|string | No default value. In `accordion` mode, it's the key of the first panel. | +| defaultActiveKey | key of the initialized active panel | string | - | | onChange | a callback function, which can be executed when you switch the panels | Function | - | ### Collapse.Panel | Property | Description | Type | Default | |----------|----------------|----------|--------------| -| key | corresponds to the `activeKey` | String | - | -| header | title of the panel | React.Element or String | - | +| key | corresponds to the `activeKey` | string | - | +| header | title of the panel | string\|ReactNode | - | diff --git a/components/collapse/index.zh-CN.md b/components/collapse/index.zh-CN.md index ff2cebf21..d65f48669 100644 --- a/components/collapse/index.zh-CN.md +++ b/components/collapse/index.zh-CN.md @@ -19,8 +19,8 @@ cols: 1 | 参数 | 说明 | 类型 | 默认值 | |------------------|----------------------------------------------|----------|---------------------------------| -| activeKey | 当前激活 tab 面板的 key| Array or String | 默认无,accordion模式下默认第一个元素| -| defaultActiveKey | 初始化选中面板的 key | String | 无 | +| activeKey | 当前激活 tab 面板的 key| string[]\|string | 默认无,accordion模式下默认第一个元素| +| defaultActiveKey | 初始化选中面板的 key | string | 无 | | onChange | 切换面板的回调 | Function | 无 | @@ -28,5 +28,5 @@ cols: 1 | 参数 | 说明 | 类型 | 默认值 | |------|------------------|-------------------------|--------| -| key | 对应 activeKey | String | 无 | -| header | 面板头内容 | React.Element or String | 无 | +| key | 对应 activeKey | string | 无 | +| header | 面板头内容 | string\|ReactNode | 无 | diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md index d26a92158..f615930c9 100644 --- a/components/date-picker/index.en-US.md +++ b/components/date-picker/index.en-US.md @@ -36,17 +36,17 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker. | Property | Description | Type | Default | |--------------|----------------|----------|--------------| -| allowClear | Whether to show clear button | bool | true | -| disabled | determine whether the DatePicker is disabled | Boolean | false | -| style | to customize the style of the input box | Object | {} | -| popupStyle | to customize the style of the popup calendar | Object | {} | -| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | String | - | -| locale | localization configuration | Object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | +| allowClear | Whether to show clear button | boolean | true | +| disabled | determine whether the DatePicker is disabled | boolean | false | +| style | to customize the style of the input box | object | {} | +| popupStyle | to customize the style of the popup calendar | object | {} | +| size | determine the size of the input box, the height of `large` and `small`, are 32px and 22px respectively, while default size is 28px | string | - | +| locale | localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | disabledDate | to specify the date that cannot be selected | function | - | | getCalendarContainer | to set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - | -| open | open state of picker | bool | - | +| open | open state of picker | boolean | - | | onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(status) | - | -| placeholder | placeholder of date input | string or array (RangePicker) | - | +| placeholder | placeholder of date input | string\|RangePicker[] | - | ### DatePicker @@ -54,10 +54,10 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker. |--------------|----------------|----------|--------------| | value | to set date | [moment](http://momentjs.com/) | - | | defaultValue | to set default date | [moment](http://momentjs.com/) | - | -| format | to set the date format, refer to [moment.js](http://momentjs.com/) | String | "YYYY-MM-DD" | +| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM-DD" | | onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - | -| showTime | to provide an additional time selection | Object/Boolean | [TimePicker Options](/components/time-picker/#api) | -| showToday | whether to show "Today" button | Boolean | true | +| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#api) | +| showToday | whether to show "Today" button | boolean | true | | disabledTime | to specify the time that cannot be selected | function(date) | - | ### MonthPicker @@ -66,9 +66,9 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker. |--------------|----------------|----------|--------------| | value | to set date | [moment](http://momentjs.com/) | - | | defaultValue | to set default date | [moment](http://momentjs.com/) | - | -| format | to set the date format, refer to [moment.js](http://momentjs.com/) | String | "YYYY-MM" | +| format | to set the date format, refer to [moment.js](http://momentjs.com/) | string | "YYYY-MM" | | onChange | a callback function, can be executed when the selected time is changing | function(date: moment, dateString: string) | - | -| monthCellContentRender | Custom month cell content render method | function(date, locale): React.Node | - | +| monthCellContentRender | Custom month cell content render method | function(date, locale): ReactNode | - | ### RangePicker @@ -76,11 +76,11 @@ The following APIs are shared by DatePicker, MonthPicker, RangePicker. |--------------|----------------|----------|--------------| | value | to set date | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | | defaultValue | to set default date | [[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | -| format | to set the date format | String | "YYYY-MM-DD HH:mm:ss" | +| format | to set the date format | string | "YYYY-MM-DD HH:mm:ss" | | onChange | a callback function, can be executed when the selected time is changing | function(dates: [moment, moment], dateStrings: [string, string]) | - | -| showTime | to provide an additional time selection | Object/Boolean | [TimePicker Options](/components/time-picker/#api) | +| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#api) | | disabledTime | to specify the time that cannot be selected | function(dates: [moment, moment], partial: `'start'|'end'`) | - | -| ranges | preseted ranges for quick selection | Object { [range: string]: [moment, moment] } | - | +| ranges | preseted ranges for quick selection | { [range: string]: [moment](http://momentjs.com/)[] } | - |