From 6b793ca7b48e176a2c99f2fe9e8279f7c6c4e3e5 Mon Sep 17 00:00:00 2001 From: jinouwuque Date: Wed, 28 Sep 2016 22:14:30 -0400 Subject: [PATCH 1/4] add momoent dependecy in the package.json Otherwise, under babel-plugin-import support, datapicker will report error. --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 45774a9a1e..c73125c569 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "css-animation": "^1.2.5", "gregorian-calendar": "~4.1.0", "gregorian-calendar-format": "~4.1.0", + "moment": "^2.15.1", "object-assign": "~4.1.0", "omit.js": "^0.1.0", "rc-animate": "~2.3.0", From 539bb33fe5a0a5bdf3d5d00740b436f2f5ff454f Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 29 Sep 2016 15:50:45 +0800 Subject: [PATCH 2/4] fix: should allow ref to react-slick, close: #3164 --- components/carousel/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/carousel/index.tsx b/components/carousel/index.tsx index b4c73f069c..e664fa1d2e 100644 --- a/components/carousel/index.tsx +++ b/components/carousel/index.tsx @@ -62,7 +62,7 @@ export default class Carousel extends React.Component { return (
- +
); } From 1e65cac7840075004acf9dbca9dd8cafa29fc362 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 29 Sep 2016 16:12:43 +0800 Subject: [PATCH 3/4] feat: Steps.Step[icon] support React.ReactNode, close: #3159 --- components/steps/demo/error.md | 7 +++---- components/steps/demo/icon.md | 8 ++++---- components/steps/demo/simple.md | 7 +++---- components/steps/demo/small-size.md | 7 +++---- components/steps/demo/step-next.md | 6 +++--- components/steps/demo/vertical-small.md | 7 +++---- components/steps/demo/vertical.md | 7 +++---- components/steps/index.en-US.md | 6 +++--- components/steps/index.zh-CN.md | 6 +++--- package.json | 2 +- 10 files changed, 29 insertions(+), 34 deletions(-) diff --git a/components/steps/demo/error.md b/components/steps/demo/error.md index 37ae33b4ef..9e1d2adf5a 100644 --- a/components/steps/demo/error.md +++ b/components/steps/demo/error.md @@ -19,10 +19,9 @@ const Step = Steps.Step; ReactDOM.render( - - - - + + + , mountNode); ```` diff --git a/components/steps/demo/icon.md b/components/steps/demo/icon.md index 044b445f0d..51383431ad 100644 --- a/components/steps/demo/icon.md +++ b/components/steps/demo/icon.md @@ -14,14 +14,14 @@ title: You can use your own custom icons by setting the property `icon` for `Steps.Step`. ````jsx -import { Steps } from 'antd'; +import { Steps, Icon } from 'antd'; const Step = Steps.Step; ReactDOM.render( - - - + + + } /> , mountNode); ```` diff --git a/components/steps/demo/simple.md b/components/steps/demo/simple.md index 5b5fe58e12..94b16ab46d 100644 --- a/components/steps/demo/simple.md +++ b/components/steps/demo/simple.md @@ -19,10 +19,9 @@ const Step = Steps.Step; ReactDOM.render( - - - - + + + , mountNode); ```` diff --git a/components/steps/demo/small-size.md b/components/steps/demo/small-size.md index 2fdd7448a4..abecad0e19 100644 --- a/components/steps/demo/small-size.md +++ b/components/steps/demo/small-size.md @@ -19,10 +19,9 @@ const Step = Steps.Step; ReactDOM.render( - - - - + + + , mountNode); ```` diff --git a/components/steps/demo/step-next.md b/components/steps/demo/step-next.md index 2edab70db3..1a5727d232 100644 --- a/components/steps/demo/step-next.md +++ b/components/steps/demo/step-next.md @@ -18,7 +18,7 @@ import { Steps, Button } from 'antd'; const Step = Steps.Step; const array = [...Array(Math.floor(Math.random() * 3) + 3)]; const steps = array.map((item, i) => ({ - title: `步骤${i + 1}`, + title: `Step ${i + 1}`, })); const App = React.createClass({ @@ -38,12 +38,12 @@ const App = React.createClass({ const { current } = this.state; return (
-
当前正在执行第 {current + 1} 步
+
Curent Step {current + 1}
{steps.map((s, i) => )}
- +
); diff --git a/components/steps/demo/vertical-small.md b/components/steps/demo/vertical-small.md index 65fcae0079..c794845993 100644 --- a/components/steps/demo/vertical-small.md +++ b/components/steps/demo/vertical-small.md @@ -19,10 +19,9 @@ const Step = Steps.Step; ReactDOM.render( - - - - + + + , mountNode); ```` diff --git a/components/steps/demo/vertical.md b/components/steps/demo/vertical.md index ac7f3c0d98..8a27dc8b30 100644 --- a/components/steps/demo/vertical.md +++ b/components/steps/demo/vertical.md @@ -19,10 +19,9 @@ const Step = Steps.Step; ReactDOM.render( - - - - + + + , mountNode); ```` diff --git a/components/steps/index.en-US.md b/components/steps/index.en-US.md index db7db5f73a..61f1f82508 100644 --- a/components/steps/index.en-US.md +++ b/components/steps/index.en-US.md @@ -39,6 +39,6 @@ A single step in the step bar. Property | Description | Type | Default -----|-----|-----|------ status | to specify the status. It will be automatically set by `current` of `Steps` if not configured. Optional values are: `wait` `process` `finish` `error` | String | wait -title | title of the step | React.Element | - -description | detail of the step, optional property | React.Element | - -icon | icon of the step, optional property | React.Element | - +title | title of the step | React.ReactNode | - +description | detail of the step, optional property | React.ReactNode | - +icon | icon of the step, optional property | string or React.ReactNode | - diff --git a/components/steps/index.zh-CN.md b/components/steps/index.zh-CN.md index c0a8fc6f1f..83a40d8ff1 100644 --- a/components/steps/index.zh-CN.md +++ b/components/steps/index.zh-CN.md @@ -40,6 +40,6 @@ title: Steps | 参数 | 说明 | 类型 | 默认值 | |----------|-----------------------------------------|------------|-------| | status | 指定状态。当不配置该属性时,会使用 Steps 的 `current` 来自动指定状态。可选:`wait` `process` `finish` `error` | String | wait | -| title | 标题 | React.Element | - | -| description | 步骤的详情描述,可选 | React.Element | - | -| icon | 步骤图标的类型,可选 | string | - | +| title | 标题 | React.ReactNode | - | +| description | 步骤的详情描述,可选 | React.ReactNode | - | +| icon | 步骤图标的类型,可选 | string or React.ReactNode | - | diff --git a/package.json b/package.json index 5f19802f18..c567fb97de 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "rc-rate": "~1.1.2", "rc-select": "~6.5.1", "rc-slider": "~5.1.0", - "rc-steps": "~2.1.5", + "rc-steps": "~2.2.0", "rc-switch": "~1.4.2", "rc-table": "~5.0.0", "rc-tabs": "~7.0.5", From 9685d06f4529acb99afb1cd1f13ea8bcaddc257c Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Thu, 29 Sep 2016 18:00:23 +0800 Subject: [PATCH 4/4] fix: should test if window exist, close: #3216 --- components/_util/getScroll.tsx | 17 +++++++++++++++++ components/affix/index.tsx | 15 +-------------- components/back-top/index.tsx | 19 +------------------ 3 files changed, 19 insertions(+), 32 deletions(-) create mode 100644 components/_util/getScroll.tsx diff --git a/components/_util/getScroll.tsx b/components/_util/getScroll.tsx new file mode 100644 index 0000000000..1b085e3e3d --- /dev/null +++ b/components/_util/getScroll.tsx @@ -0,0 +1,17 @@ +export default function getScroll(target, top) { + if (typeof window === 'undefined') { + return 0; + } + + const prop = top ? 'pageYOffset' : 'pageXOffset'; + const method = top ? 'scrollTop' : 'scrollLeft'; + const isWindow = target === window; + + let ret = isWindow ? target[prop] : target[method]; + // ie6,7,8 standard mode + if (isWindow && typeof ret !== 'number') { + ret = window.document.documentElement[method]; + } + + return ret; +} diff --git a/components/affix/index.tsx b/components/affix/index.tsx index c8b7a08744..d5f2eae115 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -4,20 +4,7 @@ import addEventListener from 'rc-util/lib/Dom/addEventListener'; import classNames from 'classnames'; import shallowequal from 'shallowequal'; import omit from 'omit.js'; - -function getScroll(target, top) { - const prop = top ? 'pageYOffset' : 'pageXOffset'; - const method = top ? 'scrollTop' : 'scrollLeft'; - const isWindow = target === window; - - let ret = isWindow ? target[prop] : target[method]; - // ie6,7,8 standard mode - if (isWindow && typeof ret !== 'number') { - ret = window.document.documentElement[method]; - } - - return ret; -} +import getScroll from '../_util/getScroll'; function getTargetRect(target): any { return target !== window ? diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index f81dea4f0b..a10e5187fc 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -4,6 +4,7 @@ import Icon from '../icon'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; import classNames from 'classnames'; import omit from 'omit.js'; +import getScroll from '../_util/getScroll'; const reqAnimFrame = (() => { if (window.requestAnimationFrame) { @@ -29,24 +30,6 @@ const easeInOutCubic = (t, b, c, d) => { } }; -function getScroll(target, top) { - if (typeof window === 'undefined') { - return 0; - } - - const prop = top ? 'pageYOffset' : 'pageXOffset'; - const method = top ? 'scrollTop' : 'scrollLeft'; - const isWindow = target === window; - - let ret = isWindow ? target[prop] : target[method]; - // ie6,7,8 standard mode - if (isWindow && typeof ret !== 'number') { - ret = window.document.documentElement[method]; - } - - return ret; -} - export interface BackTopProps { visibilityHeight?: number; onClick?: (event) => void;