"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_react=require("react"),React=_interopRequireWildcard(_react),_icon=require("../icon"),_icon2=_interopRequireDefault(_icon),_rcProgress=require("rc-progress"),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames);function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var __rest=function(e,r){var t={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(t[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)r.indexOf(s[a])<0&&(t[s[a]]=e[s[a]])}return t},statusColorMap={normal:"#108ee9",exception:"#ff5500",success:"#87d068"},Progress=function(e){function r(){return(0,_classCallCheck3.default)(this,r),(0,_possibleConstructorReturn3.default)(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return(0,_inherits3.default)(r,e),(0,_createClass3.default)(r,[{key:"render",value:function(){var e,r=this.props,t=r.prefixCls,s=r.className,a=r.percent,o=void 0===a?0:a,i=r.status,l=r.format,n=r.trailColor,c=r.size,p=r.successPercent,u=r.type,d=r.strokeWidth,f=r.width,_=r.showInfo,h=r.gapDegree,m=void 0===h?0:h,y=r.gapPosition,b=__rest(r,["prefixCls","className","percent","status","format","trailColor","size","successPercent","type","strokeWidth","width","showInfo","gapDegree","gapPosition"]),P=100<=parseInt(o.toString(),10)&&!("status"in r)?"success":i||"normal",C=void 0,R=void 0,g=l||function(e){return e+"%"};if(_){var v=void 0,q="circle"===u||"dashboard"===u?"":"-circle";v="exception"===P?l?g(o):React.createElement(_icon2.default,{type:"close"+q}):"success"===P?l?g(o):React.createElement(_icon2.default,{type:"check"+q}):g(o),C=React.createElement("span",{className:t+"-text"},v)}if("line"===u){var x={width:o+"%",height:d||("small"===c?6:8)},O={width:p+"%",height:d||("small"===c?6:8)},w=void 0!==p?React.createElement("div",{className:t+"-success-bg",style:O}):null;R=React.createElement("div",null,React.createElement("div",{className:t+"-outer"},React.createElement("div",{className:t+"-inner"},React.createElement("div",{className:t+"-bg",style:x}),w)),C)}else if("circle"===u||"dashboard"===u){var T=f||120,D={width:T,height:T,fontSize:.15*T+6},k=d||6,E=y||"dashboard"===u&&"bottom"||"top",N=m||"dashboard"===u&&75;R=React.createElement("div",{className:t+"-inner",style:D},React.createElement(_rcProgress.Circle,{percent:o,strokeWidth:k,trailWidth:k,strokeColor:statusColorMap[P],trailColor:n,prefixCls:t,gapDegree:N,gapPosition:E}),C)}var W=(0,_classnames2.default)(t,(e={},(0,_defineProperty3.default)(e,t+"-"+("dashboard"===u?"circle":u),!0),(0,_defineProperty3.default)(e,t+"-status-"+P,!0),(0,_defineProperty3.default)(e,t+"-show-info",_),(0,_defineProperty3.default)(e,t+"-"+c,c),e),s);return React.createElement("div",(0,_extends3.default)({},b,{className:W}),R)}}]),r}(React.Component);(exports.default=Progress).defaultProps={type:"line",percent:0,showInfo:!0,trailColor:"#f3f3f3",prefixCls:"dt-progress",size:"default"},Progress.propTypes={status:PropTypes.oneOf(["normal","exception","active","success"]),type:PropTypes.oneOf(["line","circle","dashboard"]),showInfo:PropTypes.bool,percent:PropTypes.number,width:PropTypes.number,strokeWidth:PropTypes.number,trailColor:PropTypes.string,format:PropTypes.func,gapDegree:PropTypes.number,default:PropTypes.oneOf(["default","small"])},module.exports=exports.default;