/*! For license information please see ed460a14133b88d57c59dc50a517b256.js.LICENSE.txt */ "use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([["sub-common/ed460a14133b88d57c59dc50a517b256"],{"./src/components/table/components/CellTips/index.tsx":function(e,t,o){var l=o("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js");var r=o("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");var n=o("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");var a=o("./node_modules/@tarojs/taro/index.js");var c=o.n(a);var s=o("./node_modules/@tarojs/runtime/dist/runtime.esm.js");var i=o("./node_modules/classnames/index.js");var u=o.n(i);var d=o("./node_modules/react/cjs/react.production.min.js");var f=o("./src/components/table/components/CellTips/index.module.scss");var m=o("./src/components/iconfont/iconfont.tsx");var p=o("./node_modules/react/cjs/react-jsx-runtime.production.min.js");var h=c().getSystemInfoSync().windowWidth;var v=32;var g=function convertPx(e){var t=e/750*h;return t};var b={color:"#333333"};var x=function ToolTip(e,t){var o=(0,d.useId)();var a=(0,d.useState)({}),i=(0,r["default"])(a,2),h=i[1];var x=e.placement,w=x===void 0?"top-start":x,j=e.defaultVisible,y=j===void 0?false:j,S=e.onVisibleChange,C=e.children,V=e.content,H=V===void 0?"请填入提示信息":V,k=e.customClassName,N=e.customStyle,R=e.customContentStyle,_=e.customContainerStyle,W=e.childrenNode;var T=(0,d.useState)(y),I=(0,r["default"])(T,2),M=I[0],E=I[1];var A=(0,d.useRef)(S);A.current=S;(0,d.useImperativeHandle)(t,(function(){return{show:function show(){return E(true)},hide:function hide(){return E(false)},visible:M}}),[M]);var J=(0,d.useCallback)((function(){E((function(e){var t;(t=A.current)===null||t===void 0?void 0:t.call(A,!e);return!e}))}),[]);var Q=(0,d.useCallback)((function(){var e;E(false);(e=A.current)===null||e===void 0?void 0:e.call(A,false)}),[]);var q=(0,d.useMemo)((function(){var e=w.split("-")[0];var t={top:"bottom",right:"left",bottom:"top",left:"right"}[e];return t}),[w]);var z=(0,d.useState)({}),F=(0,r["default"])(z,2),L=F[0],O=F[1];var P=(0,d.useRef)(L);P.current=L;var B=(0,d.useRef)(null);(0,d.useEffect)((function(){if(M&&!B.current){(0,s.nextTick)((function(){var e=c().createSelectorQuery();e.select("#content-".concat(o)).boundingClientRect((function(e){console.log("contextRectRef",e);B.current=e;h({})})).exec()}))}}),[M,B.current]);(0,d.useEffect)((function(){console.log("useLayoutEffect");var e=c().createSelectorQuery();e.selectViewport().scrollOffset();e.exec((function(e){console.log(e[0]);console.log(e[1]);O(e[0]);P.current=e[0]}))}),[]);var D=(0,d.useMemo)((function(){var e=B.current;if(!e){return{top:"9999px"}}console.log("getArrowSide==>",q,W);switch(q){case"bottom":return{left:W.cellWidth/2-g(v)/2,top:-g(v),right:"",bottom:""};case"left":return{left:W.cellWidth,right:"",top:W.cellHeight/2-g(v)/2,bottom:""};case"top":return{left:W.cellWidth/2-g(v)/2,right:"",top:W.cellHeight,bottom:""};case"right":return{left:-g(v),right:"",top:W.cellHeight/2-g(v)/2,bottom:""}}}),[q,W,B.current]);var G=(0,d.useMemo)((function(){var e=w.split("-")[1];console.log("placementSide",e);var t={};var o=B.current;if(!o){return{top:"9999px"}}console.log("contextRect",o);switch(q){case"bottom":t={bottom:g(v)-5,top:""};if(e==="start"){return(0,l["default"])((0,l["default"])({},t),{},{left:0,right:""})}else if(e==="end"){return(0,l["default"])((0,l["default"])({},t),{},{left:"",right:0})}else{return(0,l["default"])((0,l["default"])({},t),{},{left:"".concat(-((o===null||o===void 0?void 0:o.width)/2-W.cellWidth/2),"px"),right:""})}case"left":t={left:W.cellWidth+g(v)-5,right:""};if(e==="start"){return(0,l["default"])((0,l["default"])({},t),{},{top:0,bottom:""})}else if(e==="end"){return(0,l["default"])((0,l["default"])({},t),{},{top:"",bottom:"".concat(-W.cellHeight,"px")})}else{return(0,l["default"])((0,l["default"])({},t),{},{top:"".concat(-(o.height/2-W.cellHeight/2),"px"),bottom:""})}case"top":t={top:W.cellHeight+g(v)-5,bottom:""};if(e==="start"){return(0,l["default"])((0,l["default"])({},t),{},{left:0,right:""})}else if(e==="end"){return(0,l["default"])((0,l["default"])({},t),{},{left:"",right:0})}else{return(0,l["default"])((0,l["default"])({},t),{},{left:"".concat(-((o===null||o===void 0?void 0:o.width)/2-W.cellWidth/2),"px"),right:""})}case"right":t={left:"",right:g(v)-5};if(e==="start"){return(0,l["default"])((0,l["default"])({},t),{},{top:0,bottom:""})}else if(e==="end"){return(0,l["default"])((0,l["default"])({},t),{},{top:"",bottom:"".concat(-W.cellHeight,"px")})}else{return(0,l["default"])((0,l["default"])({},t),{},{top:"".concat(-(o.height/2-W.cellHeight/2),"px"),bottom:""})}}}),[q,W,B.current]);var K=(0,d.useMemo)((function(){return(0,p.jsxs)(n.View,{className:u()(f["default"].tooltip,M?"":f["default"]["tooltip-hidden"],k),style:N,children:[(0,p.jsx)(n.View,{className:u()(f["default"].arrowIcon,f["default"]["arrowIcon-".concat(q)]),style:D,children:(0,p.jsx)(m["default"],{name:"icon-shouqi1",size:v,color:b.color})}),(0,p.jsx)(n.View,{className:f["default"]["tooltip-inner"],id:"content-".concat(o),style:(0,l["default"])((0,l["default"])({},G),R),children:(0,p.jsx)(n.View,{className:f["default"]["tooltip-inner-content"],children:H})})]})}),[H,q,M,D,G]);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(n.View,{className:u()(f["default"].mark,M?"":f["default"]["tooltip-hidden"]),onClick:Q}),(0,p.jsx)(n.View,{style:_,children:(0,p.jsxs)(n.View,{className:f["default"]["tooltip-container"],children:[(0,p.jsx)(n.View,{onClick:J,children:C}),K]})})]})};t["default"]=(0,d.forwardRef)(x)}}]);