Merge branch 'wizawu-develop-1.0.0' into develop-1.0.0

This commit is contained in:
afc163 2016-04-15 11:53:11 +08:00
commit c8df93466b
4 changed files with 11 additions and 8 deletions

View File

@ -27,7 +27,7 @@ const Card = React.createClass({
); );
return ( return (
<div> <div>
<Spin spining={this.state.loading}>{container}</Spin> <Spin spinning={this.state.loading}>{container}</Spin>
切换加载状态:<Switch checked={this.state.loading} onChange={this.toggle} /> 切换加载状态:<Switch checked={this.state.loading} onChange={this.toggle} />
</div> </div>
); );

View File

@ -2,11 +2,12 @@ import React from 'react';
import { findDOMNode } from 'react-dom'; import { findDOMNode } from 'react-dom';
import classNames from 'classnames'; import classNames from 'classnames';
import { isCssAnimationSupported } from 'css-animation'; import { isCssAnimationSupported } from 'css-animation';
import warning from 'warning';
export default class Spin extends React.Component { export default class Spin extends React.Component {
static defaultProps = { static defaultProps = {
prefixCls: 'ant-spin', prefixCls: 'ant-spin',
spining: true, spinning: true,
} }
static propTypes = { static propTypes = {
@ -19,6 +20,7 @@ export default class Spin extends React.Component {
} }
componentDidMount() { componentDidMount() {
warning(!('spining' in this.props), '`spining` property of Popover is a spell mistake, use `spinning` instead.');
if (!isCssAnimationSupported) { if (!isCssAnimationSupported) {
// Show text in IE8/9 // Show text in IE8/9
findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`; findDOMNode(this).className += ` ${this.props.prefixCls}-show-text`;
@ -26,14 +28,15 @@ export default class Spin extends React.Component {
} }
render() { render() {
const { className, size, prefixCls, tip } = this.props; const { className, size, prefixCls, tip, spining = true } = this.props;
const spinning = this.props.spinning && spining; // Backwards support
let spinClassName = classNames({ const spinClassName = classNames({
[prefixCls]: true, [prefixCls]: true,
[`${prefixCls}-sm`]: size === 'small', [`${prefixCls}-sm`]: size === 'small',
[`${prefixCls}-lg`]: size === 'large', [`${prefixCls}-lg`]: size === 'large',
[className]: !!className, [className]: !!className,
[`${prefixCls}-spining`]: this.props.spining, [`${prefixCls}-spinning`]: spinning,
[`${prefixCls}-show-text`]: !!this.props.tip, [`${prefixCls}-show-text`]: !!this.props.tip,
}); });
@ -48,7 +51,7 @@ export default class Spin extends React.Component {
if (this.isNestedPattern()) { if (this.isNestedPattern()) {
return ( return (
<div className={this.props.spining ? (`${prefixCls}-nested-loading`) : ''}> <div className={spinning ? (`${prefixCls}-nested-loading`) : ''}>
{spinElement} {spinElement}
<div className={`${prefixCls}-container`}> <div className={`${prefixCls}-container`}>
{this.props.children} {this.props.children}

View File

@ -18,5 +18,5 @@ english: Spin
| 参数 | 类型 | 默认值 | 说明 | | 参数 | 类型 | 默认值 | 说明 |
|------------|----------------|-------------|--------------| |------------|----------------|-------------|--------------|
| size | enum | default | spin组件中点的大小可选值为 small default large | | size | enum | default | spin组件中点的大小可选值为 small default large |
| spining | boolean | true | 用于内嵌其他组件的模式,可以关闭 loading 效果 | | spinning | boolean | true | 用于内嵌其他组件的模式,可以关闭 loading 效果 |
| tip | string | 无 | 自定义描述文案 | | tip | string | 无 | 自定义描述文案 |

View File

@ -18,7 +18,7 @@
transition: opacity 0.3s @ease-in-out-circ; transition: opacity 0.3s @ease-in-out-circ;
font-size: @font-size-base; font-size: @font-size-base;
&-spining { &-spinning {
opacity: 1; opacity: 1;
position: static; position: static;
visibility: visible; visibility: visible;