import * as Nerv from 'nervjs' import classnames from 'classnames' export interface ProgressProps { className?: string, pending?: boolean, percent?: string | number, status?: string } class Progress extends Nerv.Component { renderProgressClassNames (props: ProgressProps) { return classnames('at-progress at-progress--bar', [ props.percent == 100 ? 'at-progress--success' : '', props.status && props.status == 'error' ? 'at-progress--error' : '' ] , props.className) } renderText (props) { const {percent, status} = props if (percent == 100) { return } if (status && status == 'error') { return } return {percent}% } render () { const props = this.props const {percent= 0} = props const { style, onDragLeave, onDragOver, onDrop, onMouseOver, onMouseEnter, onMouseOut, onMouseLeave, onClick, children } = props const needProps = { children, onDragLeave, onDragOver, onDrop, onMouseOver, onMouseOut, onMouseEnter, onMouseLeave, onClick } if (percent >= 100) { props.onStatusSuccess && props.onStatusSuccess(percent) } const barInnerStyle = { width: `${percent}%` } const classnames = this.renderProgressClassNames(props) const renderSpecialText = this.renderText(props) const barWrapperStyle = { height: `${props.strokeWidth || 8}px` } return (
{renderSpecialText}
) } componentDidMount () { } componentWillReceiveProps (nextProps) { } } export default Progress