|
|
@ -16,14 +16,15 @@ let Line = React.createClass({ |
|
|
|
status: React.PropTypes.oneOf(['normal', 'exception', 'active', 'success']), |
|
|
|
showInfo: React.PropTypes.bool, |
|
|
|
percent: React.PropTypes.number, |
|
|
|
strokeWidth: React.PropTypes.number |
|
|
|
strokeWidth: React.PropTypes.number, |
|
|
|
}, |
|
|
|
getDefaultProps() { |
|
|
|
return { |
|
|
|
percent: 0, |
|
|
|
strokeWidth: 10, |
|
|
|
status: 'normal', // exception active |
|
|
|
showInfo: true |
|
|
|
format: '${percent}%', |
|
|
|
showInfo: true, |
|
|
|
}; |
|
|
|
}, |
|
|
|
render() { |
|
|
@ -35,22 +36,23 @@ let Line = React.createClass({ |
|
|
|
|
|
|
|
let progressInfo; |
|
|
|
let fullCls = ''; |
|
|
|
const text = (typeof props.format === 'string') ? |
|
|
|
props.format.replace('${percent}', props.percent) : props.format; |
|
|
|
|
|
|
|
if(props.showInfo === true){ |
|
|
|
if (props.status === 'exception') { |
|
|
|
progressInfo = ( |
|
|
|
<span className={prefixCls + '-line-text'}> |
|
|
|
<Icon type="exclamation-circle" /> |
|
|
|
</span> |
|
|
|
<span className={prefixCls + '-line-text'}>{text}</span> |
|
|
|
); |
|
|
|
} else if (props.status === 'success') { |
|
|
|
progressInfo = ( |
|
|
|
<span className={prefixCls + '-line-text'}> |
|
|
|
<Icon type="exclamation-circle" /> |
|
|
|
<Icon type="check" /> |
|
|
|
</span> |
|
|
|
); |
|
|
|
} else { |
|
|
|
progressInfo = ( |
|
|
|
<span className={prefixCls + '-line-text'}>{props.percent}%</span> |
|
|
|
<span className={prefixCls + '-line-text'}>{text}</span> |
|
|
|
); |
|
|
|
} |
|
|
|
} else { |
|
|
@ -79,14 +81,15 @@ let Circle = React.createClass({ |
|
|
|
status: React.PropTypes.oneOf(['normal', 'exception', 'success']), |
|
|
|
percent: React.PropTypes.number, |
|
|
|
strokeWidth: React.PropTypes.number, |
|
|
|
width: React.PropTypes.number |
|
|
|
width: React.PropTypes.number, |
|
|
|
}, |
|
|
|
getDefaultProps: function () { |
|
|
|
return { |
|
|
|
width: 132, |
|
|
|
percent: 0, |
|
|
|
strokeWidth: 6, |
|
|
|
status: 'normal' // exception |
|
|
|
format: '${percent}%', |
|
|
|
status: 'normal', // exception |
|
|
|
}; |
|
|
|
}, |
|
|
|
render() { |
|
|
@ -102,11 +105,11 @@ let Circle = React.createClass({ |
|
|
|
'fontSize': props.width * 0.16 + 6 |
|
|
|
}; |
|
|
|
let progressInfo; |
|
|
|
const text = (typeof props.format === 'string') ? |
|
|
|
props.format.replace('${percent}', props.percent) : props.format; |
|
|
|
if (props.status === 'exception') { |
|
|
|
progressInfo = ( |
|
|
|
<span className={prefixCls + '-circle-text'}> |
|
|
|
<Icon type="exclamation" /> |
|
|
|
</span> |
|
|
|
<span className={prefixCls + '-circle-text'}>{text}</span> |
|
|
|
); |
|
|
|
} else if (props.status === 'success') { |
|
|
|
progressInfo = ( |
|
|
@ -116,7 +119,7 @@ let Circle = React.createClass({ |
|
|
|
); |
|
|
|
} else { |
|
|
|
progressInfo = ( |
|
|
|
<span className={prefixCls + '-circle-text'}>{props.percent}%</span> |
|
|
|
<span className={prefixCls + '-circle-text'}>{text}</span> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|