Files
chazhi_admin_broker/public/h5/assets/wd-search.D-880VPn.js
2026-03-11 18:24:59 +08:00

2 lines
4.1 KiB
JavaScript

var Q=Object.defineProperty,R=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var B=(c,s,a)=>s in c?Q(c,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[s]=a,S=(c,s)=>{for(var a in s||(s={}))Y.call(s,a)&&B(c,a,s[a]);if(x)for(var a of x(s))Z.call(s,a)&&B(c,a,s[a]);return c},b=(c,s)=>R(c,X(s));var p=(c,s,a)=>new Promise((t,d)=>{var i=o=>{try{l(a.next(o))}catch(n){d(n)}},u=o=>{try{l(a.throw(o))}catch(n){d(n)}},l=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,u);l((a=a.apply(c,s)).next())});import{aJ as V,a5 as r,aI as ee,a6 as ae,d as le,aT as se,r as v,W as F,aU as oe,T as L,a8 as ce,bj as w,c as m,j as _,w as f,k as y,aq as N,af as C,l as te,aa as W,_ as I,n as ue,s as $,m as j,t as z,u as P,aP as ne,x as re}from"./index-B-O76M86.js";const de=b(S({},ae),{customInputClass:V(""),modelValue:V(""),useSuffixSlot:r(!1),placeholder:String,cancelTxt:String,light:r(!1),hideCancel:r(!1),disabled:r(!1),maxlength:ee(-1),placeholderLeft:r(!1),focus:r(!1),focusWhenClear:r(!1),placeholderStyle:String,placeholderClass:V("")}),ie={name:"wd-search",options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}},fe=le(b(S({},ie),{props:de,emits:["update:modelValue","change","clear","search","focus","blur","cancel"],setup(c,{emit:s}){const a=c,t=s,{translate:d}=se("search"),i=v(!1),u=v(!1),l=v(""),o=v(!0),n=v(!1);F(()=>a.modelValue,e=>{l.value=e,e&&(u.value=!0)},{immediate:!0}),F(()=>a.focus,e=>{if(e){if(a.disabled)return;k()}}),oe(()=>{a.focus&&k()});const H=L(()=>`wd-search ${a.light?"is-light":""} ${a.hideCancel?"is-without-cancel":""} ${a.customClass}`),U=L(()=>{const e={display:l.value===""&&o.value?"flex":"none"};return ce(e)});function g(e){return p(this,null,function*(){u.value=e,yield w(),i.value=e})}function k(){return p(this,null,function*(){a.disabled||(yield w(100),o.value=!1,g(!0))})}function q(e){l.value=e.detail.value,t("update:modelValue",e.detail.value),t("change",{value:e.detail.value})}function D(){return p(this,null,function*(){l.value="",a.focusWhenClear&&(n.value=!0,i.value=!1),yield w(),a.focusWhenClear?(o.value=!1,g(!0)):(o.value=!0,g(!1)),t("change",{value:""}),t("update:modelValue",""),t("clear")})}function G({detail:{value:e}}){t("search",{value:e})}function J(){o.value=!1,t("focus",{value:l.value})}function M(){return p(this,null,function*(){if(yield w(150),n.value){n.value=!1;return}o.value=!l.value,u.value=!o.value,i.value=!1,t("blur",{value:l.value})})}function A(){t("cancel",{value:l.value})}return(e,T)=>{const E=ue,h=te,K=ne;return _(),m(h,{class:$(H.value),style:W(e.customStyle)},{default:f(()=>[y(h,{class:"wd-search__block"},{default:f(()=>[N(e.$slots,"prefix",{},void 0,!0),y(h,{class:"wd-search__field"},{default:f(()=>[e.placeholderLeft?C("",!0):(_(),m(h,{key:0,style:W(U.value),class:"wd-search__cover",onClick:k},{default:f(()=>[y(I,{name:"search","custom-class":"wd-search__search-icon"}),y(E,{class:$(`wd-search__placeholder-txt ${e.placeholderClass}`)},{default:f(()=>[j(z(e.placeholder||P(d)("search")),1)]),_:1},8,["class"])]),_:1},8,["style"])),u.value||l.value||e.placeholderLeft?(_(),m(I,{key:1,name:"search","custom-class":"wd-search__search-left-icon"})):C("",!0),u.value||l.value||e.placeholderLeft?(_(),m(K,{key:2,placeholder:e.placeholder||P(d)("search"),"placeholder-class":`wd-search__placeholder-txt ${e.placeholderClass}`,"placeholder-style":e.placeholderStyle,"confirm-type":"search",modelValue:l.value,"onUpdate:modelValue":T[0]||(T[0]=O=>l.value=O),class:$(["wd-search__input",e.customInputClass]),onFocus:J,onInput:q,onBlur:M,onConfirm:G,disabled:e.disabled,maxlength:e.maxlength,focus:i.value},null,8,["placeholder","placeholder-class","placeholder-style","modelValue","class","disabled","maxlength","focus"])):C("",!0),l.value?(_(),m(I,{key:3,"custom-class":"wd-search__clear wd-search__clear-icon",name:"error-fill",onClick:D})):C("",!0)]),_:1})]),_:3}),e.hideCancel?C("",!0):N(e.$slots,"suffix",{key:0},()=>[y(h,{class:"wd-search__cancel",onClick:A},{default:f(()=>[j(z(e.cancelTxt||P(d)("cancel")),1)]),_:1})],!0)]),_:3},8,["class","style"])}}})),ve=re(fe,[["__scopeId","data-v-7650d631"]]);export{ve as _};