/*! For license information please see 94cec9d2db1462f72fa256a2d7515ed8.js.LICENSE.txt */
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([["sub-common/94cec9d2db1462f72fa256a2d7515ed8"],{"./src/components/table/index.tsx":function(e,t,i){var n=i("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");var l=i("./node_modules/@babel/runtime/helpers/esm/typeof.js");var s=i("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");var o=i("./node_modules/@tarojs/taro/index.js");var r=i.n(o);var a=i("./node_modules/classnames/index.js");var d=i.n(a);var u=i("./node_modules/react/cjs/react.production.min.js");var c=i("./src/components/infiniteScroll/index.tsx");var f=i("./src/components/LoadMore/index.tsx");var p=i("./src/components/table/components/CellTips/index.tsx");var v=i("./src/components/table/index.module.scss");var h=i("./node_modules/react/cjs/react-jsx-runtime.production.min.js");var m=function generateCellId(e,t){return"cell-".concat(e,"-").concat(t)};var x=function Table(e){var t;var i=e.columns,o=e.dataSource,a=e.onLoadMore,x=e.height,w=x===void 0?400:x,j=e.moreText,g=j===void 0?"查看更多":j,b=e.loadingText,T=b===void 0?"加载中":b,C=e.noMoreText,y=C===void 0?"没有更多了":C,M=e.emptyText,_=M===void 0?"暂无数据":M,k=e.safeAreaInsetBottom,S=k===void 0?true:k;var N=function handleShowMore(){a&&a()};var I=(0,u.useCallback)((function(e){var t={};if(typeof e.ellipsis==="boolean"&&e.ellipsis){t[v["default"].ellipsis_1]=true}if((0,l["default"])(e.ellipsis)==="object"&&e.ellipsis.isEllipsis){var i=e.ellipsis.rows;if(i===2){t[v["default"].ellipsis_2]=true}else{t[v["default"].ellipsis_1]=true}}return t}),[]);var V=(0,u.useMemo)((function(){if(o){if(o.list.length===0&&o.list.length===o.total){return(0,h.jsx)(f["default"],{emptyText:_,status:"empty"})}else if(o.list.length<o.total){return(0,h.jsx)(f["default"],{moreText:g,status:"more",onClick:N})}else if(o.list.length>=o.total){return(0,h.jsx)(f["default"],{noMoreText:y,status:"noMore"})}}else{return(0,h.jsx)(f["default"],{moreText:g,loadingText:T,noMoreText:y,status:"loading"})}}),[o]);var R=(0,u.useRef)(null);var A=(0,u.useRef)({title:"",tips:"",width:""});var H=(0,u.useRef)({cellWidth:0,cellHeight:0});var L=(0,u.useState)({position:"fixed"}),W=(0,n["default"])(L,2),B=W[0],J=W[1];var E=(0,u.useState)({}),F=(0,n["default"])(E,2),Q=F[1];var q=function handleClickCell(e,t,i,n){var s;if((s=R.current)!==null&&s!==void 0&&s.visible){var o;(o=R.current)===null||o===void 0?void 0:o.hide()}if((0,l["default"])(t.showTipsConfig)==="object"&&t.showTipsConfig.isShowTips){var a,d,u;A.current={width:t.width,title:i[t.dataIndex],tips:typeof((a=t.showTipsConfig)===null||a===void 0?void 0:a.tips)==="function"?(d=t.showTipsConfig)===null||d===void 0?void 0:d.tips(i[t.dataIndex],i,n):(u=t.showTipsConfig)===null||u===void 0?void 0:u.tips};Q({});setTimeout((function(){var t=r().createSelectorQuery();t.select("#".concat(e)).boundingClientRect();t.exec((function(e){var t;H.current={cellWidth:e[0].width,cellHeight:e[0].height};J({position:"fixed",top:"".concat(e[0].top,"px"),left:"".concat(e[0].left,"px")});(t=R.current)===null||t===void 0?void 0:t.show();console.log("res===》",e)}))}),100)}};var z=(0,u.useMemo)((function(){return(0,h.jsx)(s.Text,{id:"hiddenTips",className:v["default"].td,style:{color:"transparent",width:H.current.cellWidth,height:H.current.cellHeight},children:A.current.title})}),[A.current.title]);var D=function sourceContainer(){var e;return(0,h.jsxs)(h.Fragment,{children:[!!(o!==null&&o!==void 0&&(e=o.list)!==null&&e!==void 0&&e.length)&&o.list.map((function(e,t){return(0,h.jsx)(s.View,{className:d()(v["default"].tr,v["default"]["bg-line"]),children:i.map((function(i,n){var l=m(t,n);if(i.render){return(0,h.jsx)(s.View,{id:l,className:v["default"].td,style:{width:i.width},children:i.render(e[i.dataIndex],e,t)},n)}else{return(0,h.jsx)(s.View,{id:l,className:d()(v["default"].td,I(i)),style:{width:i.width},onClick:function onClick(){return q(l,i,e,t)},children:e[i.dataIndex]},n)}}))},e.key)})),V]})};return(0,h.jsxs)(s.View,{className:v["default"].table,children:[(0,h.jsx)(s.View,{className:d()(v["default"].tr,v["default"]["bg-header"]),children:i.map((function(e){return(0,h.jsx)(s.View,{className:v["default"].th,style:{width:e.width},children:e.title},e.key)}))}),(0,h.jsx)(c["default"],{enableLoadMoreStatus:false,safeAreaInsetBottom:S,children:D()}),(0,h.jsx)(p["default"],{childrenNode:H.current,ref:R,customContainerStyle:B,placement:"top",content:(t=A.current)===null||t===void 0?void 0:t.tips,children:z})]})};t["default"]=x}}]);