import _extends from"babel-runtime/helpers/extends";import _defineProperty from"babel-runtime/helpers/defineProperty";import _classCallCheck from"babel-runtime/helpers/classCallCheck";import _createClass from"babel-runtime/helpers/createClass";import _possibleConstructorReturn from"babel-runtime/helpers/possibleConstructorReturn";import _inherits from"babel-runtime/helpers/inherits";var __rest=this&&this.__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 o=0;for(s=Object.getOwnPropertySymbols(e);o<s.length;o++)r.indexOf(s[o])<0&&(t[s[o]]=e[s[o]])}return t};import*as PropTypes from"prop-types";import*as React from"react";import Icon from"../icon";import{Circle}from"rc-progress";import classNames from"classnames";var statusColorMap={normal:"#108ee9",exception:"#ff5500",success:"#87d068"},Progress=function(e){function r(){return _classCallCheck(this,r),_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return _inherits(r,e),_createClass(r,[{key:"render",value:function(){var e,r=this.props,t=r.prefixCls,s=r.className,o=r.percent,a=void 0===o?0:o,i=r.status,n=r.format,l=r.trailColor,c=r.size,p=r.successPercent,m=r.type,f=r.strokeWidth,d=r.width,u=r.showInfo,h=r.gapDegree,y=void 0===h?0:h,b=r.gapPosition,P=__rest(r,["prefixCls","className","percent","status","format","trailColor","size","successPercent","type","strokeWidth","width","showInfo","gapDegree","gapPosition"]),g=parseInt(a.toString(),10)>=100&&!("status"in r)?"success":i||"normal",C=void 0,v=void 0,_=n||function(e){return e+"%"};if(u){var R=void 0,w="circle"===m||"dashboard"===m?"":"-circle";R="exception"===g?n?_(a):React.createElement(Icon,{type:"close"+w}):"success"===g?n?_(a):React.createElement(Icon,{type:"check"+w}):_(a),C=React.createElement("span",{className:t+"-text"},R)}if("line"===m){var x={width:a+"%",height:f||("small"===c?6:8)},O={width:p+"%",height:f||("small"===c?6:8)},T=void 0!==p?React.createElement("div",{className:t+"-success-bg",style:O}):null;v=React.createElement("div",null,React.createElement("div",{className:t+"-outer"},React.createElement("div",{className:t+"-inner"},React.createElement("div",{className:t+"-bg",style:x}),T)),C)}else if("circle"===m||"dashboard"===m){var E=d||120,N={width:E,height:E,fontSize:.15*E+6},k=f||6,I=b||"dashboard"===m&&"bottom"||"top",W=y||"dashboard"===m&&75;v=React.createElement("div",{className:t+"-inner",style:N},React.createElement(Circle,{percent:a,strokeWidth:k,trailWidth:k,strokeColor:statusColorMap[g],trailColor:l,prefixCls:t,gapDegree:W,gapPosition:I}),C)}var j=classNames(t,(_defineProperty(e={},t+"-"+("dashboard"===m?"circle":m),!0),_defineProperty(e,t+"-status-"+g,!0),_defineProperty(e,t+"-show-info",u),_defineProperty(e,t+"-"+c,c),e),s);return React.createElement("div",_extends({},P,{className:j}),v)}}]),r}(React.Component);export default Progress;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"])};