/*! For license information please see 216035333732f885c2e3b1420ca19cd2.js.LICENSE.txt */
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([["sub-common/216035333732f885c2e3b1420ca19cd2"],{"./src/components/dropDown-item/index.tsx":function(e,o,t){var n=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js");var s=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js");var i=t("./node_modules/@tarojs/taro/index.js");var a=t.n(i);var r=t("./node_modules/react/cjs/react.production.min.js");var l=t("./node_modules/classnames/index.js");var c=t.n(l);var u=t("./src/components/iconfont/iconfont.tsx");var d=t("./src/components/popup/index.tsx");var p=t("./src/components/cell/index.tsx");var v=t("./src/components/dropDown-item/index.module.scss");var f=t("./node_modules/react/cjs/react-jsx-runtime.production.min.js");var m=function DropDownItem(e,o){var t;var i=e.children,l=e.direction,m=l===void 0?"down":l,h=e.title,w=h===void 0?"":h,x=e.value,j=e.options,y=j===void 0?[]:j,b=e.change,C=e.activeColor,D=e.showOverlay,k=D===void 0?true:D,g=e.hasBottomBtn,I=g===void 0?false:g,S=e.customClassName,O=e.customStyle,N=e.onCloseOverlay;var _=(0,r.useState)(false),P=(0,n["default"])(_,2),T=P[0],V=P[1];(0,r.useImperativeHandle)(o,(function(){return{show:T,closePopup:function closePopup(){V(false)},showPopup:function showPopup(){V(true)}}}),[T]);var z=function handleClickOption(e){b===null||b===void 0?void 0:b(e)};var B=(0,r.useState)((y===null||y===void 0?void 0:(t=y[0])===null||t===void 0?void 0:t.text)||""),q=(0,n["default"])(B,2),A=q[0],H=q[1];var J=(0,r.useMemo)((function(){var e=x;return y===null||y===void 0?void 0:y.map((function(o,t){var n=o.text,s=o.value;e===s&&H(n);return(0,f.jsx)(p["default"],{title:n,desc:"",isLink:true,onClick:function onClick(){return z(s)}},t)}))}),[x]);var L=function getIconName(){if(m==="up"){return T?"icon-zhankai1":"icon-shouqi1"}return T?"icon-shouqi1":"icon-zhankai1"};var M=function handleClickTitle(){console.log("handleClickTitle",T);N===null||N===void 0?void 0:N();V((function(e){return!e}))};var R=function handleClosePopup(){if(I){return}V(false);N===null||N===void 0?void 0:N()};var E=(0,r.useState)("unset"),Q=(0,n["default"])(E,2),F=Q[0],G=Q[1];var K=function getOverlayStyle(){return{position:!k?"fixed":"absolute",top:0}};var U=(0,r.useState)(0),W=(0,n["default"])(U,2),X=W[0],Y=W[1];(0,r.useEffect)((function(){var e=a().createSelectorQuery();e.select("#DropDownItem").boundingClientRect();e.selectViewport().scrollOffset();e.exec((function(e){console.log("res==>",e);Y(e[1].scrollHeight);if(m==="down"){G("".concat(e[0].bottom,"px"))}else{G("".concat(e[0].top,"px"))}}))}),[]);var Z=(0,r.useMemo)((function(){if(m==="up"){return{position:"absolute",top:0,height:F}}else{return{position:"absolute",top:F,height:"calc(".concat("".concat(X,"px")," - ",F,")")}}}),[F]);return(0,f.jsxs)(s.View,{className:v["default"].dropDownItem,id:"DropDownItem",children:[(0,f.jsxs)(s.View,{className:c()(S,v["default"]["dropDownItem--title"]),style:O,onClick:M,children:[(0,f.jsx)(s.Text,{className:v["default"]["dropDownItem--title--text"],style:T?{color:C}:{},children:w||A}),(0,f.jsx)(u["default"],{name:L(),size:20,color:T?C:"#7f7f7f"})]}),(0,f.jsx)(d["default"],{onClose:R,showOverLay:k,show:T,showTitle:false,safeAreaInsetBottom:false,customStyle:Z,overlayStyle:K(),position:m==="down"?"top":"bottom",children:i||(0,f.jsx)(s.View,{className:v["default"].dropDownItemOptions,children:J})})]})};o["default"]=(0,r.forwardRef)(m)}}]);