{"remainingRequest":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xypm-web\\node_modules\\@jiaminghi\\data-view\\lib\\components\\activeRingChart\\src\\main.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\@jiaminghi\\data-view\\lib\\components\\activeRingChart\\src\\main.vue","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\babel.config.js","mtime":1675214572901},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.object.keys\";\nimport _toConsumableArray from \"D:/jenkins/workspace/xypm-web/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport _defineProperty from \"D:/jenkins/workspace/xypm-web/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport Charts from '@jiaminghi/charts';\nimport dvDigitalFlop from \"../../digitalFlop/src/main.vue\";\nimport { deepMerge } from '@jiaminghi/charts/lib/util/index';\nimport { deepClone } from '@jiaminghi/c-render/lib/plugin/util';\nexport default {\n  name: 'DvActiveRingChart',\n  components: {\n    dvDigitalFlop: dvDigitalFlop\n  },\n  props: {\n    config: {\n      type: Object,\n      default: function _default() {\n        return {};\n      }\n    }\n  },\n  data: function data() {\n    return {\n      defaultConfig: {\n        /**\n         * @description Ring radius\n         * @type {String|Number}\n         * @default radius = '50%'\n         * @example radius = '50%' | 100\n         */\n        radius: '50%',\n\n        /**\n         * @description Active ring radius\n         * @type {String|Number}\n         * @default activeRadius = '55%'\n         * @example activeRadius = '55%' | 110\n         */\n        activeRadius: '55%',\n\n        /**\n         * @description Ring data\n         * @type {Array<Object>}\n         * @default data = [{ name: '', value: 0 }]\n         */\n        data: [{\n          name: '',\n          value: 0\n        }],\n\n        /**\n         * @description Ring line width\n         * @type {Number}\n         * @default lineWidth = 20\n         */\n        lineWidth: 20,\n\n        /**\n         * @description Active time gap (ms)\n         * @type {Number}\n         * @default activeTimeGap = 3000\n         */\n        activeTimeGap: 3000,\n\n        /**\n         * @description Ring color (hex|rgb|rgba|color keywords)\n         * @type {Array<String>}\n         * @default color = [Charts Default Color]\n         * @example color = ['#000', 'rgb(0, 0, 0)', 'rgba(0, 0, 0, 1)', 'red']\n         */\n        color: [],\n\n        /**\n         * @description Digital flop style\n         * @type {Object}\n         */\n        digitalFlopStyle: {\n          fontSize: 25,\n          fill: '#fff'\n        },\n\n        /**\n         * @description Digital flop toFixed\n         * @type {Number}\n         */\n        digitalFlopToFixed: 0,\n\n        /**\n         * @description Digital flop unit\n         * @type {String}\n         */\n        digitalFlopUnit: '',\n\n        /**\n         * @description CRender animationCurve\n         * @type {String}\n         * @default animationCurve = 'easeOutCubic'\n         */\n        animationCurve: 'easeOutCubic',\n\n        /**\n         * @description CRender animationFrame\n         * @type {String}\n         * @default animationFrame = 50\n         */\n        animationFrame: 50,\n\n        /**\n         * @description showOriginValue\n         * @type {Boolean}\n         * @default showOriginValue = false\n         */\n        showOriginValue: false\n      },\n      mergedConfig: null,\n      chart: null,\n      activeIndex: 0,\n      animationHandler: ''\n    };\n  },\n  computed: {\n    digitalFlop: function digitalFlop() {\n      var mergedConfig = this.mergedConfig,\n          activeIndex = this.activeIndex;\n      if (!mergedConfig) return {};\n      var digitalFlopStyle = mergedConfig.digitalFlopStyle,\n          digitalFlopToFixed = mergedConfig.digitalFlopToFixed,\n          data = mergedConfig.data,\n          showOriginValue = mergedConfig.showOriginValue,\n          digitalFlopUnit = mergedConfig.digitalFlopUnit;\n      var value = data.map(function (_ref) {\n        var value = _ref.value;\n        return value;\n      });\n      var displayValue;\n\n      if (showOriginValue) {\n        displayValue = value[activeIndex];\n      } else {\n        var sum = value.reduce(function (all, v) {\n          return all + v;\n        }, 0);\n        var percent = parseFloat(value[activeIndex] / sum * 100) || 0;\n        displayValue = percent;\n      }\n\n      return {\n        content: showOriginValue ? \"{nt}\".concat(digitalFlopUnit) : \"{nt}\".concat(digitalFlopUnit || '%'),\n        number: [displayValue],\n        style: digitalFlopStyle,\n        toFixed: digitalFlopToFixed\n      };\n    },\n    ringName: function ringName() {\n      var mergedConfig = this.mergedConfig,\n          activeIndex = this.activeIndex;\n      if (!mergedConfig) return '';\n      return mergedConfig.data[activeIndex].name;\n    },\n    fontSize: function fontSize() {\n      var mergedConfig = this.mergedConfig;\n      if (!mergedConfig) return '';\n      return \"font-size: \".concat(mergedConfig.digitalFlopStyle.fontSize, \"px;\");\n    }\n  },\n  watch: {\n    config: function config() {\n      var animationHandler = this.animationHandler,\n          mergeConfig = this.mergeConfig,\n          setRingOption = this.setRingOption;\n      clearTimeout(animationHandler);\n      this.activeIndex = 0;\n      mergeConfig();\n      setRingOption();\n    }\n  },\n  methods: {\n    init: function init() {\n      var initChart = this.initChart,\n          mergeConfig = this.mergeConfig,\n          setRingOption = this.setRingOption;\n      initChart();\n      mergeConfig();\n      setRingOption();\n    },\n    initChart: function initChart() {\n      var $refs = this.$refs;\n      this.chart = new Charts($refs['active-ring-chart']);\n    },\n    mergeConfig: function mergeConfig() {\n      var defaultConfig = this.defaultConfig,\n          config = this.config;\n      this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {});\n    },\n    setRingOption: function setRingOption() {\n      var getRingOption = this.getRingOption,\n          chart = this.chart,\n          ringAnimation = this.ringAnimation;\n      var option = getRingOption();\n      chart.setOption(option, true);\n      ringAnimation();\n    },\n    getRingOption: function getRingOption() {\n      var mergedConfig = this.mergedConfig,\n          getRealRadius = this.getRealRadius;\n      var radius = getRealRadius();\n      mergedConfig.data.forEach(function (dataItem) {\n        dataItem.radius = radius;\n      });\n      return {\n        series: [_objectSpread(_objectSpread({\n          type: 'pie'\n        }, mergedConfig), {}, {\n          outsideLabel: {\n            show: false\n          }\n        })],\n        color: mergedConfig.color\n      };\n    },\n    getRealRadius: function getRealRadius() {\n      var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n      var mergedConfig = this.mergedConfig,\n          chart = this.chart;\n      var radius = mergedConfig.radius,\n          activeRadius = mergedConfig.activeRadius,\n          lineWidth = mergedConfig.lineWidth;\n      var maxRadius = Math.min.apply(Math, _toConsumableArray(chart.render.area)) / 2;\n      var halfLineWidth = lineWidth / 2;\n      var realRadius = active ? activeRadius : radius;\n      if (typeof realRadius !== 'number') realRadius = parseInt(realRadius) / 100 * maxRadius;\n      var insideRadius = realRadius - halfLineWidth;\n      var outSideRadius = realRadius + halfLineWidth;\n      return [insideRadius, outSideRadius];\n    },\n    ringAnimation: function ringAnimation() {\n      var _this = this;\n\n      var activeIndex = this.activeIndex,\n          getRingOption = this.getRingOption,\n          chart = this.chart,\n          getRealRadius = this.getRealRadius;\n      var radius = getRealRadius();\n      var active = getRealRadius(true);\n      var option = getRingOption();\n      var data = option.series[0].data;\n      data.forEach(function (dataItem, i) {\n        if (i === activeIndex) {\n          dataItem.radius = active;\n        } else {\n          dataItem.radius = radius;\n        }\n      });\n      chart.setOption(option, true);\n      var activeTimeGap = option.series[0].activeTimeGap;\n      this.animationHandler = setTimeout(function (foo) {\n        activeIndex += 1;\n        if (activeIndex >= data.length) activeIndex = 0;\n        _this.activeIndex = activeIndex;\n\n        _this.ringAnimation();\n      }, activeTimeGap);\n    }\n  },\n  mounted: function mounted() {\n    var init = this.init;\n    init();\n  },\n  beforeDestroy: function beforeDestroy() {\n    var animationHandler = this.animationHandler;\n    clearTimeout(animationHandler);\n  }\n};",null]}