{"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\\scrollRankingBoard\\src\\main.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xypm-web\\node_modules\\@jiaminghi\\data-view\\lib\\components\\scrollRankingBoard\\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":456789000000},{"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/web.dom.iterable\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"regenerator-runtime/runtime\";\nimport _asyncToGenerator from \"D:/jenkins/workspace/xypm-web/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport \"core-js/modules/es6.array.fill\";\nimport _defineProperty from \"D:/jenkins/workspace/xypm-web/node_modules/@babel/runtime/helpers/esm/defineProperty.js\";\nimport _toConsumableArray from \"D:/jenkins/workspace/xypm-web/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";\nimport \"core-js/modules/es6.array.sort\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport autoResize from \"../../../mixin/autoResize\";\nimport { deepMerge } from '@jiaminghi/charts/lib/util/index';\nimport { deepClone } from '@jiaminghi/c-render/lib/plugin/util';\nexport default {\n  name: 'DvScrollRankingBoard',\n  mixins: [autoResize],\n  props: {\n    config: {\n      type: Object,\n      default: function _default() {\n        return {};\n      }\n    }\n  },\n  data: function data() {\n    return {\n      ref: 'scroll-ranking-board',\n      defaultConfig: {\n        /**\n         * @description Board data\n         * @type {Array<Object>}\n         * @default data = []\n         */\n        data: [],\n        /**\n         * @description Row num\n         * @type {Number}\n         * @default rowNum = 5\n         */\n        rowNum: 5,\n        /**\n         * @description Scroll wait time\n         * @type {Number}\n         * @default waitTime = 2000\n         */\n        waitTime: 2000,\n        /**\n         * @description Carousel type\n         * @type {String}\n         * @default carousel = 'single'\n         * @example carousel = 'single' | 'page'\n         */\n        carousel: 'single',\n        /**\n         * @description Value unit\n         * @type {String}\n         * @default unit = ''\n         * @example unit = 'ton'\n         */\n        unit: '',\n        /**\n         * @description Auto sort by value\n         * @type {Boolean}\n         * @default sort = true\n         */\n        sort: true,\n        /**\n         * @description Value formatter\n         * @type {Function}\n         * @default valueFormatter = null\n         */\n        valueFormatter: null\n      },\n      mergedConfig: null,\n      rowsData: [],\n      rows: [],\n      heights: [],\n      animationIndex: 0,\n      animationHandler: '',\n      updater: 0\n    };\n  },\n  watch: {\n    config: function config() {\n      var stopAnimation = this.stopAnimation,\n        calcData = this.calcData;\n      stopAnimation();\n      calcData();\n    }\n  },\n  methods: {\n    afterAutoResizeMixinInit: function afterAutoResizeMixinInit() {\n      var calcData = this.calcData;\n      calcData();\n    },\n    onResize: function onResize() {\n      var mergedConfig = this.mergedConfig,\n        calcHeights = this.calcHeights;\n      if (!mergedConfig) return;\n      calcHeights(true);\n    },\n    calcData: function calcData() {\n      var mergeConfig = this.mergeConfig,\n        calcRowsData = this.calcRowsData;\n      mergeConfig();\n      calcRowsData();\n      var calcHeights = this.calcHeights;\n      calcHeights();\n      var animation = this.animation;\n      animation(true);\n    },\n    mergeConfig: function mergeConfig() {\n      var config = this.config,\n        defaultConfig = this.defaultConfig;\n      this.mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {});\n    },\n    calcRowsData: function calcRowsData() {\n      var _this$mergedConfig = this.mergedConfig,\n        data = _this$mergedConfig.data,\n        rowNum = _this$mergedConfig.rowNum,\n        sort = _this$mergedConfig.sort;\n      sort && data.sort(function (_ref, _ref2) {\n        var a = _ref.value;\n        var b = _ref2.value;\n        if (a > b) return -1;\n        if (a < b) return 1;\n        if (a === b) return 0;\n      });\n      var value = data.map(function (_ref3) {\n        var value = _ref3.value;\n        return value;\n      });\n      var min = Math.min.apply(Math, _toConsumableArray(value)) || 0;\n\n      // abs of min\n      var minAbs = Math.abs(min);\n      var max = Math.max.apply(Math, _toConsumableArray(value)) || 0;\n\n      // abs of max\n      var maxAbs = Math.abs(max);\n      var total = max + minAbs;\n      data = data.map(function (row, i) {\n        return _objectSpread(_objectSpread({}, row), {}, {\n          ranking: i + 1,\n          percent: (row.value + minAbs) / total * 100\n        });\n      });\n      var rowLength = data.length;\n      if (rowLength > rowNum && rowLength < 2 * rowNum) {\n        data = [].concat(_toConsumableArray(data), _toConsumableArray(data));\n      }\n      data = data.map(function (d, i) {\n        return _objectSpread(_objectSpread({}, d), {}, {\n          scroll: i\n        });\n      });\n      this.rowsData = data;\n      this.rows = data;\n    },\n    calcHeights: function calcHeights() {\n      var onresize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n      var height = this.height,\n        mergedConfig = this.mergedConfig;\n      var rowNum = mergedConfig.rowNum,\n        data = mergedConfig.data;\n      var avgHeight = height / rowNum;\n      this.avgHeight = avgHeight;\n      if (!onresize) this.heights = new Array(data.length).fill(avgHeight);\n    },\n    animation: function () {\n      var _animation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n        var _this$heights;\n        var start,\n          avgHeight,\n          animationIndex,\n          mergedConfig,\n          rowsData,\n          animation,\n          updater,\n          waitTime,\n          carousel,\n          rowNum,\n          rowLength,\n          animationNum,\n          rows,\n          back,\n          _args = arguments;\n        return regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) switch (_context.prev = _context.next) {\n            case 0:\n              start = _args.length > 0 && _args[0] !== undefined ? _args[0] : false;\n              avgHeight = this.avgHeight, animationIndex = this.animationIndex, mergedConfig = this.mergedConfig, rowsData = this.rowsData, animation = this.animation, updater = this.updater;\n              waitTime = mergedConfig.waitTime, carousel = mergedConfig.carousel, rowNum = mergedConfig.rowNum;\n              rowLength = rowsData.length;\n              if (!(rowNum >= rowLength)) {\n                _context.next = 6;\n                break;\n              }\n              return _context.abrupt(\"return\");\n            case 6:\n              if (!start) {\n                _context.next = 11;\n                break;\n              }\n              _context.next = 9;\n              return new Promise(function (resolve) {\n                return setTimeout(resolve, waitTime);\n              });\n            case 9:\n              if (!(updater !== this.updater)) {\n                _context.next = 11;\n                break;\n              }\n              return _context.abrupt(\"return\");\n            case 11:\n              animationNum = carousel === 'single' ? 1 : rowNum;\n              rows = rowsData.slice(animationIndex);\n              rows.push.apply(rows, _toConsumableArray(rowsData.slice(0, animationIndex)));\n              this.rows = rows.slice(0, rowNum + 1);\n              this.heights = new Array(rowLength).fill(avgHeight);\n              _context.next = 18;\n              return new Promise(function (resolve) {\n                return setTimeout(resolve, 300);\n              });\n            case 18:\n              if (!(updater !== this.updater)) {\n                _context.next = 20;\n                break;\n              }\n              return _context.abrupt(\"return\");\n            case 20:\n              (_this$heights = this.heights).splice.apply(_this$heights, [0, animationNum].concat(_toConsumableArray(new Array(animationNum).fill(0))));\n              animationIndex += animationNum;\n              back = animationIndex - rowLength;\n              if (back >= 0) animationIndex = back;\n              this.animationIndex = animationIndex;\n              this.animationHandler = setTimeout(animation, waitTime - 300);\n            case 26:\n            case \"end\":\n              return _context.stop();\n          }\n        }, _callee, this);\n      }));\n      function animation() {\n        return _animation.apply(this, arguments);\n      }\n      return animation;\n    }(),\n    stopAnimation: function stopAnimation() {\n      var animationHandler = this.animationHandler,\n        updater = this.updater;\n      this.updater = (updater + 1) % 999999;\n      if (!animationHandler) return;\n      clearTimeout(animationHandler);\n    }\n  },\n  destroyed: function destroyed() {\n    var stopAnimation = this.stopAnimation;\n    stopAnimation();\n  }\n};",null]}