@zym-com/input-search
Version:
搜索输入框
69 lines (68 loc) • 6.92 kB
JavaScript
(function(n,a){typeof exports=="object"&&typeof module<"u"?module.exports=a(require("react")):typeof define=="function"&&define.amd?define(["react"],a):(n=typeof globalThis<"u"?globalThis:n||self,n["echart-bar-interval"]=a(n.React))})(this,function(n){"use strict";var a={exports:{}},d={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var S=n,m=Symbol.for("react.element"),b=Symbol.for("react.fragment"),T=Object.prototype.hasOwnProperty,$=S.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,C={key:!0,ref:!0,__self:!0,__source:!0};function y(l,e,c){var o,r={},h=null,p=null;c!==void 0&&(h=""+c),e.key!==void 0&&(h=""+e.key),e.ref!==void 0&&(p=e.ref);for(o in e)T.call(e,o)&&!C.hasOwnProperty(o)&&(r[o]=e[o]);if(l&&l.defaultProps)for(o in e=l.defaultProps,e)r[o]===void 0&&(r[o]=e[o]);return{$$typeof:m,type:l,key:h,ref:p,props:r,_owner:$.current}}d.Fragment=b,d.jsx=y,d.jsxs=y,a.exports=d;var i=a.exports;const s={boxClass:"_boxClass_1qhzk_1",inputClass:"_inputClass_1qhzk_4"};return({...l})=>{const e=l.configuration;console.log(l,e);const c=n.useRef(null);l.dataSource||requestAnimationFrame(()=>{c.current.value=""});let o="";if(e.textShadowChild){const t=e.shadow;o=t.shadowOffsetX+"px "+t.shadowOffsetY+"px "+t.shadowBlur+"px "+t.shadowColor}let r={};if(e.backgroundStyleChild){let t="";e.bgColorSelect=="solidBgColor"?t=e.solidBgColor:e.bgColorSelect=="gradientBgColor"?t="linear-gradient("+e.anamorphism.direction+"deg, "+e.anamorphism.startVal+", "+e.anamorphism.endVal+")":e.bgColorSelect=="BgImage"&&(t="url("+e.image+") center center / "+e.imageSize+" no-repeat "),r={background:t,borderRadius:e.borderRadiusName?e.borderRadiusName:0}}let h={};e.borderStyleChild&&(h={borderStyle:e.borderStyle,borderWidth:e.borderWidthName+"px",borderColor:e.borderColor});const p={width:l.base.width+"px",height:l.base.height+"px",...r,textShadow:o,color:e.textStyle.color,fontFamily:e.textStyle.fontFamily,fontSize:e.textStyle.fontSize+"px",fontStyle:e.textStyle.fontStyle,fontWeight:e.textStyle.fontWeight,letterSpacing:e.textStyle.letterSpacing+"px",textAlign:e.levelalignment,...h,opacity:e.transparency?e.transparency:1,paddingLeft:e.valuePadding.l+"px",paddingRight:e.valuePadding.r+"px",boxSizing:"border-box"};let g="";if(e.searchBtnWH){let t="";e.searchBtnType&&(e.searchBtnType=="solidBgColor"?t=`<span style='
color: ${e.searchBtnTextStyle.color};
font-family: ${e.searchBtnTextStyle.fontFamily};
font-size: ${e.searchBtnTextStyle.fontSize}px;
font-style: ${e.searchBtnTextStyle.fontStyle};
font-weight: ${e.searchBtnTextStyle.fontWeight};
letter-spacing: ${e.searchBtnTextStyle.letterSpacing}px;
text-indent: ${e.searchBtnTextStyle.letterSpacing}px;
'>${e.searchBtnText}</span>`:e.searchBtnType=="BgImage"&&(t=`
<img style="
width: ${e.searchBtnImgWH.W}px;
height: ${e.searchBtnImgWH.H}px;"
src=${e.searchBtnImage} />
`)),g=`<div style='
position: absolute;
right: ${e.searchBtnRT.R}px;
top:${e.searchBtnRT.T}%;
transform: translateY(-${e.searchBtnRT.T}%);
width: ${e.searchBtnWH.W}px;
height: ${e.searchBtnWH.H}px;
display:flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: ${e.searchBtnBgStype?e.searchBtnBgStype=="solidBgColor"?e.searchBtnBgColor:"url("+e.searchBtnBgImage+") center center / cover no-repeat ":""};
border-radius: ${e.searchBtnBgStype?e.searchBtnBorderRadius:0}px;
'>${t}</div>`}const x={inputValueChange:(t,f,u)=>{u.valueTrigger&&f=="onchange"&&l.bindCallbackParams("onchange",{value:t.target.value}),u.blurTrigger&&f=="onblur"&&l.bindCallbackParams("onblur",{value:t.target.value})},btnClick:(t,f)=>{f&&l.bindCallbackParams(t,{value:c.current.value})}};return i.jsx(i.Fragment,{children:i.jsxs("div",{style:{width:l.base.width+"px",height:l.base.height+"px"},className:s.boxClass,children:[e.placeholderTextStyle&&i.jsx("style",{children:`
.${s.boxClass} input::-webkit-input-placeholder{
color: ${e.placeholderTextStyle.color};
font-family: ${e.placeholderTextStyle.fontFamily};
font-size: ${e.placeholderTextStyle.fontSize+"px"};
font-style: ${e.placeholderTextStyle.fontStyle};
font-weight: ${e.placeholderTextStyle.fontWeight};
letter-spacing: ${e.placeholderTextStyle.letterSpacing+"px"};
}
.${s.boxClass} input:-moz-placeholder{
color: ${e.placeholderTextStyle.color};
font-family: ${e.placeholderTextStyle.fontFamily};
font-size: ${e.placeholderTextStyle.fontSize+"px"};
font-style: ${e.placeholderTextStyle.fontStyle};
font-weight: ${e.placeholderTextStyle.fontWeight};
letter-spacing: ${e.placeholderTextStyle.letterSpacing+"px"};
}
.${s.boxClass} input::-moz-placeholder{
color: ${e.placeholderTextStyle.color};
font-family: ${e.placeholderTextStyle.fontFamily};
font-size: ${e.placeholderTextStyle.fontSize+"px"};
font-style: ${e.placeholderTextStyle.fontStyle};
font-weight: ${e.placeholderTextStyle.fontWeight};
letter-spacing: ${e.placeholderTextStyle.letterSpacing+"px"};
}
.${s.boxClass} input:-ms-input-placeholder{
color: ${e.placeholderTextStyle.color};
font-family: ${e.placeholderTextStyle.fontFamily};
font-size: ${e.placeholderTextStyle.fontSize+"px"};
font-style: ${e.placeholderTextStyle.fontStyle};
font-weight: ${e.placeholderTextStyle.fontWeight};
letter-spacing: ${e.placeholderTextStyle.letterSpacing+"px"};
}
`}),i.jsx("input",{ref:c,type:"text",defaultValue:l.dataSource,className:s.inputClass,style:p,placeholder:e.placeholderValue,onChange:t=>x.inputValueChange(t,"onchange",e),onBlur:t=>x.inputValueChange(t,"onblur",e)},l.dataSource),i.jsx("div",{dangerouslySetInnerHTML:{__html:g},onClick:()=>x.btnClick("onclick",e.clickTrigger)})]})})}});