{"remainingRequest":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/layout/components/TagsView/ScrollPane.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/layout/components/TagsView/ScrollPane.vue","mtime":1701742078549},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n\n// +----------------------------------------------------------------------\n// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权\n// +----------------------------------------------------------------------\n// | Author: CRMEB Team <admin@crmeb.com>\n// +----------------------------------------------------------------------\n\nconst tagAndTagSpacing = 4; // tagAndTagSpacing\n\nexport default {\n  name: 'ScrollPane',\n  data() {\n    return {\n      left: 0,\n    };\n  },\n  computed: {\n    scrollWrapper() {\n      return this.$refs.scrollContainer.$refs.wrap;\n    },\n  },\n  methods: {\n    handleScroll(e) {\n      const eventDelta = e.wheelDelta || -e.deltaY * 40;\n      const $scrollWrapper = this.scrollWrapper;\n      $scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4;\n    },\n    moveToTarget(currentTag) {\n      const $container = this.$refs.scrollContainer.$el;\n      const $containerWidth = $container.offsetWidth;\n      const $scrollWrapper = this.scrollWrapper;\n      const tagList = this.$parent.$refs.tag;\n\n      let firstTag = null;\n      let lastTag = null;\n\n      // find first tag and last tag\n      if (tagList.length > 0) {\n        firstTag = tagList[0];\n        lastTag = tagList[tagList.length - 1];\n      }\n\n      if (firstTag === currentTag) {\n        $scrollWrapper.scrollLeft = 0;\n      } else if (lastTag === currentTag) {\n        $scrollWrapper.scrollLeft = $scrollWrapper.scrollWidth - $containerWidth;\n      } else {\n        // find preTag and nextTag\n        const currentIndex = tagList.findIndex((item) => item === currentTag);\n        const prevTag = tagList[currentIndex - 1];\n        const nextTag = tagList[currentIndex + 1];\n\n        // the tag's offsetLeft after of nextTag\n        const afterNextTagOffsetLeft = nextTag.$el.offsetLeft + nextTag.$el.offsetWidth + tagAndTagSpacing;\n\n        // the tag's offsetLeft before of prevTag\n        const beforePrevTagOffsetLeft = prevTag.$el.offsetLeft - tagAndTagSpacing;\n\n        if (afterNextTagOffsetLeft > $scrollWrapper.scrollLeft + $containerWidth) {\n          $scrollWrapper.scrollLeft = afterNextTagOffsetLeft - $containerWidth;\n        } else if (beforePrevTagOffsetLeft < $scrollWrapper.scrollLeft) {\n          $scrollWrapper.scrollLeft = beforePrevTagOffsetLeft;\n        }\n      }\n    },\n  },\n};\n",null]}