import React, {Component} from 'react'
|
import PropTypes from 'prop-types'
|
import { Progress } from 'antd'
|
|
// import './index.scss'
|
|
class MkProgress extends Component {
|
static propTpyes = {
|
config: PropTypes.object,
|
value: PropTypes.any
|
}
|
|
render() {
|
const { value, config } = this.props
|
|
let type = config.showType || 'line'
|
|
if (type === 'line') {
|
return <Progress percent={value} type="line" className={config.strokeLinecap || ''} strokeWidth={config.strokeWidth || 8} strokeColor={config.color} showInfo={config.showInfo === 'true'}/>
|
}
|
|
let width = config.outlineWidth || 0
|
|
if (this.progress && (!width || width > this.progress.clientWidth)) {
|
width = this.progress.clientWidth
|
}
|
|
return (
|
<div ref={(ref) => this.progress = ref } style={{textAlign: config.textAlign || 'left'}}>
|
<Progress percent={value} width={width} type={type} strokeLinecap={config.strokeLinecap || 'round'} strokeWidth={config.strokeWidth || 8} strokeColor={config.color} showInfo={config.showInfo === 'true'}/>
|
</div>
|
)
|
}
|
}
|
|
export default MkProgress
|