/**
 * @file VerticalPointStepItem component
 * @author liangxiaojun(liangxiaojun@derbysoft.com)
 */

import React, {Component} from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';

class VerticalPointStepItem extends Component {

    constructor(props, ...restArgs) {

        super(props, ...restArgs);

        this.getRightBarClassName = ::this.getRightBarClassName;
        this.touchTapHandler = ::this.touchTapHandler;

    }

    getRightBarClassName() {

        const {activatedStep, finishedStep, index} = this.props;

        if (finishedStep > index || activatedStep > index) {
            return ' full';
        }

        if (activatedStep === index || finishedStep === index) {
            return '';
        }

        return ' hidden';

    }

    touchTapHandler(e) {
        e.preventDefault();
        const {activatedStep, finishedStep, index, disabled, onTouchTap} = this.props;
        !disabled && activatedStep !== index && finishedStep >= index && onTouchTap && onTouchTap(index, e);
    }

    render() {

        const {className, style, activatedStep, finishedStep, index, value, isFirst, isLast, disabled} = this.props,

            itemClassName = classNames('vertical-point-step-item',
                activatedStep == index ? ' activated' : (finishedStep >= index ? ' finished' : ''), {
                    first: isFirst,
                    last: isLast,
                    disabled: disabled,
                    [className]: className
                });

        return (
            <div className={itemClassName}
                 style={style}>

                <div className="bg-bar"></div>

                <div className="bg-round">
                    <div className="round"
                         onTouchTap={this.touchTapHandler}></div>
                </div>

                <div className="title">
                    {value.title}
                </div>

            </div>
        );

    }
};

VerticalPointStepItem.propTypes = {

    className: PropTypes.string,
    style: PropTypes.object,

    activatedStep: PropTypes.number,
    finishedStep: PropTypes.number,
    index: PropTypes.number,
    value: PropTypes.object,
    isFirst: PropTypes.bool,
    isLast: PropTypes.bool,

    disabled: PropTypes.bool,

    onTouchTap: PropTypes.func

};

VerticalPointStepItem.defaultProps = {

    className: '',
    style: null,

    activatedStep: 0,
    finishedStep: 0,
    index: 0,
    value: {},
    isFirst: true,
    isLast: false,

    disabled: false

};

export default VerticalPointStepItem;
@@ -209,16 +209,78 @@
 ames';%0A%0A
+import PureRender from '../_vendors/PureRender';%0A%0A@PureRender%0A
 class Ve
@@ -2037,24 +2037,66 @@
 %0A%0A    %7D%0A%7D;%0A%0A
+process.env.NODE_ENV !== 'production' && (
 VerticalPoin
@@ -2436,16 +2436,17 @@
 .func%0A%0A%7D
+)
 ;%0A%0AVerti
@@ -2484,45 +2484,8 @@
  %7B%0A%0A
-    className: '',%0A    style: null,%0A%0A
     

update VerticalPointStepItem