"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames2=_interopRequireDefault(require("../helpers/libs/classNames")),_styleToCssString=_interopRequireDefault(require("../helpers/libs/styleToCssString")),_colors=require("../helpers/colors");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!=_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}var defaultColors={normal:_colors.colors.positive,progress:_colors.colors.positive,error:_colors.colors.assertive,success:_colors.colors.balanced};(0,_baseComponent.default)({properties:{prefixCls:{type:String,value:"wux-progress"},percent:{type:Number,value:0,observer:"updateStyle"},strokeWidth:{type:Number,value:10,observer:"updateStyle"},activeColor:{type:String,value:"",observer:"updateStyle"},backgroundColor:{type:String,value:"#f3f3f3"},status:{type:String,value:"normal",observer:"updateStyle"},shape:{type:String,value:"round"},barStyle:{type:[String,Object],value:"",observer:function(e){this.setData({extStyle:(0,_styleToCssString.default)(e)})}},showInfo:{type:Boolean,value:!1}},data:{width:0,style:"",extStyle:""},computed:{classes:["prefixCls, shape, status",function(e,t,r){return{wrap:(0,_classNames2.default)(e,_defineProperty(_defineProperty({},"".concat(e,"--").concat(t),t),"".concat(e,"--").concat(r),r)),outer:"".concat(e,"__outer"),inner:"".concat(e,"__inner"),bar:"".concat(e,"__bar"),text:"".concat(e,"__text")}}]},methods:{updateStyle:function(){var e=Object.assign({},this.data,0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}),t=e.percent,r=e.strokeWidth,o=e.activeColor,e=e.status,t=t<0?0:100<t?100:t,r=0<r?r:10,o=o||defaultColors[e]||defaultColors.normal,e="background-color: ".concat(o,"; width: ").concat(t,"%; height: ").concat(r,"px;");this.setData({width:t,style:e})}},attached:function(){this.updateStyle()}});