{"version":3,"sources":["webpack:///D:/Code2024/图鸟模板-社区/tuniao-ui/components/tn-waterfall/tn-waterfall.vue?c6e7","webpack:///D:/Code2024/图鸟模板-社区/tuniao-ui/components/tn-waterfall/tn-waterfall.vue?22ec","webpack:///D:/Code2024/图鸟模板-社区/tuniao-ui/components/tn-waterfall/tn-waterfall.vue?3bba","webpack:///D:/Code2024/图鸟模板-社区/tuniao-ui/components/tn-waterfall/tn-waterfall.vue?17ce","uni-app:///tuniao-ui/components/tn-waterfall/tn-waterfall.vue","webpack:///D:/Code2024/图鸟模板-社区/tuniao-ui/components/tn-waterfall/tn-waterfall.vue?1b16","webpack:///D:/Code2024/图鸟模板-社区/tuniao-ui/components/tn-waterfall/tn-waterfall.vue?55ad"],"names":["name","props","value","type","default","idKey","addTime","computed","copyValue","watch","data","leftList","rightList","tempList","mounted","methods","splitData","leftRect","rightRect","item","setTimeout","cloneData","clear","remove","index","modify"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAqI;AACrI;AACgE;AACL;AACsC;;;AAGjG;AAC8M;AAC9M,gBAAgB,qNAAU;AAC1B,EAAE,kFAAM;AACR,EAAE,mGAAM;AACR,EAAE,4GAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,uGAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACvBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AClBA;AAAA;AAAA;AAAA;AAAg0B,CAAgB,8zBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBCQp1B;EACAA;EACAC;IACA;IACAC;MACAC;MACAC;QACA;MACA;IACA;IACA;IACA;IACAC;MACAF;MACAC;IACA;IACA;IACA;IACAE;MACAH;MACAC;IACA;EACA;EACAG;IACA;IACAC;MACA;IACA;EACA;EACAC;IACAD;MACA;MACA;MACA;MACA;MACA;IACA;EACA;EACAE;IACA;MACA;MACAC;MACA;MACAC;MACA;MACAC;IACA;EACA;EACAC;IACA;IACA;EACA;EACAC;IACA;IACAC;MAAA;MAAA;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA,IACA;kBAAA;kBAAA;gBAAA;gBAAA;cAAA;gBAAA;gBAAA,OAEA;cAAA;gBAAAC;gBAAA;gBAAA,OACA;cAAA;gBAAAC;gBAEAC,0BACA;gBACA;gBAAA,IACAA;kBAAA;kBAAA;gBAAA;gBAAA;cAAA;gBAEA;gBACA;kBACA;gBACA;kBACA;gBACA;kBACA;kBACA;oBACA;kBACA;oBACA;kBACA;gBACA;;gBAEA;gBACA;gBACA;gBACA;kBACAC;oBACA;kBACA;gBACA;kBACA;gBACA;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA;IACA;IACA;IACAC;MACA;IACA;IACA;IACAC;MACA;MACA;MACA;MACA;IACA;IACA;IACAC;MAAA;MACA;MACA;MACAC;QAAA;MAAA;MACA;QACA;QACA;MACA;QACA;QACAA;UAAA;QAAA;QACA;MACA;MACA;MACAA;QAAA;MAAA;MACA;IACA;IACA;IACAC;MAAA;MACA;MACA;MACAD;QAAA;MAAA;MACA;QACA;QACA;MACA;QACA;QACAA;UAAA;QAAA;QACA;MACA;MACA;MACAA;QAAA;MAAA;MACA;QACA;QACAd;QACA;MACA;IACA;EACA;AACA;AAAA,4B;;;;;;;;;;;;ACpJA;AAAA;AAAA;AAAA;AAA+iD,CAAgB,q+CAAG,EAAC,C;;;;;;;;;;;ACAnkD;AACA,OAAO,KAAU,EAAE,kBAKd","file":"tuniao-ui/components/tn-waterfall/tn-waterfall.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./tn-waterfall.vue?vue&type=template&id=5c0a015c&scoped=true&\"\nvar renderjs\nimport script from \"./tn-waterfall.vue?vue&type=script&lang=js&\"\nexport * from \"./tn-waterfall.vue?vue&type=script&lang=js&\"\nimport style0 from \"./tn-waterfall.vue?vue&type=style&index=0&id=5c0a015c&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"5c0a015c\",\n  null,\n  false,\n  components,\n  renderjs\n)\n\ncomponent.options.__file = \"tuniao-ui/components/tn-waterfall/tn-waterfall.vue\"\nexport default component.exports","export * from \"-!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--17-0!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./tn-waterfall.vue?vue&type=template&id=5c0a015c&scoped=true&\"","var components\nvar render = function () {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\n  _vm.$initSSP()\n  if (_vm.$scope.data.scopedSlotsCompiler === \"augmented\") {\n    _vm.$setSSP(\"left\", {\n      leftList: _vm.leftList,\n    })\n    _vm.$setSSP(\"right\", {\n      rightList: _vm.rightList,\n    })\n  }\n  _vm.$callSSP()\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--13-1!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./tn-waterfall.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--13-1!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./tn-waterfall.vue?vue&type=script&lang=js&\"","<template>\r\n  <view class=\"tn-waterfall-class tn-waterfall\">\r\n    <view id=\"tn-waterfall-left\" class=\"tn-waterfall__column\"><slot name=\"left\" :leftList=\"leftList\"></slot></view>\r\n    <view id=\"tn-waterfall-right\" class=\"tn-waterfall__column\"><slot name=\"right\" :rightList=\"rightList\"></slot></view>\r\n  </view>\n</template>\n\n<script>\r\n  export default {\r\n    name: 'tn-waterfall',\r\n    props: {\r\n      // 瀑布流数据\r\n      value: {\r\n        type: Array,\r\n        default() {\r\n          return []\r\n        }\r\n      },\r\n      // 数据的id值,根据id值对数据执行删除操作\r\n      // 如数据为:{id: 1, name: 'tuniao'},那么该值设置为id\r\n      idKey: {\r\n        type: String,\r\n        default: 'id'\r\n      },\r\n      // 每次插入数据的事件间隔,间隔越长能保证两列高度相近,但是用户体验不好\r\n      // 单位ms\r\n      addTime: {\r\n        type: Number,\r\n        default: 200\r\n      }\r\n    },\r\n    computed: {\r\n      // 破坏value变量引用,否则数据会保持不变\r\n      copyValue() {\r\n        return this.cloneData(this.value)\r\n      }\r\n    },\r\n    watch: {\r\n      copyValue(nVal, oVal) {\r\n        // 取出数组发生变化的部分\r\n        let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0\r\n        // 拼接原有数据\r\n        this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex)))\r\n        this.splitData()\r\n      }\r\n    },\r\n    data() {\r\n      return {\r\n        // 左列表\r\n        leftList: [],\r\n        // 右列表\r\n        rightList: [],\r\n        // 临时列表\r\n        tempList: []\r\n      }\r\n    },\r\n    mounted() {\r\n      this.tempList = this.cloneData(this.copyValue)\r\n      this.splitData()\r\n    },\r\n    methods: {\r\n      // 拆分数据\r\n      async splitData() {\r\n        if (!this.tempList.length) return\r\n        \r\n        let leftRect = await this._tGetRect('#tn-waterfall-left')\r\n        let rightRect = await this._tGetRect('#tn-waterfall-right')\r\n        \r\n        let item = this.tempList[0]\r\n        // 因为经过上面两个await节点查询和定时器,数组有可能会变成空[],导致item的值为undefined\r\n        // 解决多次快速滚动会导致数据乱的问题\r\n        if (!item) return\r\n        \r\n        // 如果左边小于或者等于右边,就添加到左边,否则添加到右边\r\n        if (leftRect.height < rightRect.height) {\r\n          this.leftList.push(item)\r\n        } else if (leftRect.height > rightRect.height) {\r\n          this.rightList.push(item)\r\n        } else {\r\n          // 为了保证前两项添加时,左右两边都还没有内容,这时候根据队列长度判断下一项该放在哪一边\r\n          if (this.leftList.length <= this.rightList.length) {\r\n            this.leftList.push(item)\r\n          } else {\r\n            this.rightList.push(item)\r\n          }\r\n        }\r\n        \r\n        // 移除临时数组中已处理的数据\r\n        this.tempList.splice(0, 1)\r\n        // 如果还有数据则继续执行\r\n        if (this.tempList.length) {\r\n          setTimeout(() => {\r\n            this.splitData()\r\n          }, this.addTime)\r\n        } else {\r\n          this.$emit('finish')\r\n        }\r\n      },\r\n      // 复制对象和数组(深度复制不会影响原对象和数组)\r\n      cloneData(data) {\r\n        return JSON.parse(JSON.stringify(data))\r\n      },\r\n      // 清空数据列表\r\n      clear() {\r\n        this.leftList = []\r\n        this.rightList = []\r\n        this.$emit('input', [])\r\n        this.tempList = []\r\n      },\r\n      // 清除指定的某一条数据,根据id来实现\r\n      remove(id) {\r\n        // 如果查找不到就返回-1\r\n        let index = -1\r\n        index = this.leftList.findIndex(val => val[this.idKey] == id)\r\n        if (index != -1) {\r\n          // 如果index不等于-1,说明已经找到了指定的数据\r\n          this.leftList.splice(index, 1)\r\n        } else {\r\n          // 同理于上面的方法\r\n          index = this.rightList.findIndex(val => val[this.idKey] == id)\r\n          if (index != -1) this.rightList.splice(index, 1)\r\n        }\r\n        // 同时删除父组件对应的数据\r\n        index = this.value.findIndex(val => val[this.idKey] == id)\r\n        if (index != -1) this.$emit('input', this.value.splice(index, 1))\r\n      },\r\n      // 修改指定数据的属性\r\n      modify(id, key, value) {\r\n        // 如果查找不到就返回-1\r\n        let index = -1\r\n        index = this.leftList.findIndex(val => val[this.idKey] == id)\r\n        if (index != -1) {\r\n          // 如果index不等于-1,说明已经找到了指定的数据\r\n          this.leftList[index][key] = value\r\n        } else {\r\n          // 同理于上面的方法\r\n          index = this.rightList.findIndex(val => val[this.idKey] == id)\r\n          if (index != -1) this.rightList[index][key] = value\r\n        }\r\n        // 同时删除父组件对应的数据\r\n        index = this.value.findIndex(val => val[this.idKey] == id)\r\n        if(index != -1) {\r\n          let data = this.cloneData(this.value)\r\n          data[index][key] = value\r\n          this.$emit('input', data)\r\n        }\r\n      }\r\n    }\r\n  }\n</script>\n\n<style lang=\"scss\" scoped>\r\n  .tn-waterfall {\r\n    display: flex;\r\n    flex-direction: row;\r\n    align-items: flex-start;\r\n    \r\n    &__column {\r\n      display: flex;\r\n      flex-direction: column;\r\n      flex: 1;\r\n      height: auto;\r\n    }\r\n  }\n</style>\n","import mod from \"-!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./tn-waterfall.vue?vue&type=style&index=0&id=5c0a015c&lang=scss&scoped=true&\"; export default mod; export * from \"-!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./tn-waterfall.vue?vue&type=style&index=0&id=5c0a015c&lang=scss&scoped=true&\"","// extracted by mini-css-extract-plugin\n    if(module.hot) {\n      // 1731893493341\n      var cssReload = require(\"D:/self software/HBuilderX.3.99.2023122611/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"/\",\"locals\":false});\n      module.hot.dispose(cssReload);\n      module.hot.accept(undefined, cssReload);\n    }\n  "],"sourceRoot":""}