"use strict";var _baseComponent=_interopRequireDefault(require("../helpers/baseComponent")),_classNames3=_interopRequireDefault(require("../helpers/libs/classNames")),_styleToCssString=_interopRequireDefault(require("../helpers/libs/styleToCssString"));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _defineProperty(t,e,o){return(e=_toPropertyKey(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:String(t)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0===o)return("string"===e?String:Number)(t);o=o.call(t,e||"default");if("object"!=_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}(0,_baseComponent.default)({externalClasses:["wux-class-badge"],properties:{prefixCls:{type:String,value:"wux-badge"},count:{type:Number,value:0},overflowCount:{type:Number,value:99},dot:{type:Boolean,value:!1},showZero:{type:Boolean,value:!1},status:{type:String,value:""},text:{type:String,value:""},position:{type:String,value:"topRight"},backgroundColor:{type:String,value:"#ed3f14"},hideShadow:{type:Boolean,value:!1},title:{type:String,value:""}},data:{finalCount:0,badgeStyle:""},observers:_defineProperty(_defineProperty({},"count, overflowCount",function(t,e){this.updated({count:t,overflowCount:e})}),"backgroundColor",function(t){this.updateStyle(t)}),computed:{classes:["prefixCls, position, hideShadow, status",function(t,e,o,r){return{wrap:(0,_classNames3.default)(t,_defineProperty(_defineProperty({},"".concat(t,"--position-").concat(e),e),"".concat(t,"--hide-shadow"),o)),status:"".concat(t,"__status"),statusDot:(0,_classNames3.default)("".concat(t,"__status-dot"),_defineProperty({},"".concat(t,"__status-dot--").concat(r),r)),statusText:"".concat(t,"__status-text"),dot:"".concat(t,"__dot"),count:"".concat(t,"__count")}}]},methods:{updated:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.data,e=t.count,t=t.overflowCount,t=t<=e?"".concat(t,"+"):e;this.setData({finalCount:t})},updateStyle:function(t){t=(0,_styleToCssString.default)({backgroundColor:t});t!==this.data.badgeStyle&&this.setData({badgeStyle:t})}}});