驭风行PC站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

9 lines
12 KiB

import{D as q,k as L,l as X,aw as xe,N as je,aj as P,L as Z,f as ke,al as Ke,I as We,h as m,E as Ue,aa as Ye,o as v,c as C,g as h,F as ee,n as y,u as t,r as W,a as T,z as I,w as B,ak as U,am as te,b as qe,C as Xe,au as _e,t as Y,i as Ge,aq as we}from"./Ca9y1zsW.js";import{b as oe,m as Je,c as Qe}from"./CeUmO8rY.js";import{q as Pe,i as Ce,b as Ze,h as ae,u as Se,v as et,ad as tt,ae as ot,E as A,X as at,_ as nt,w as st}from"./BPRC2v3K.js";import{b as it}from"./YeUNH851.js";import{i as Ie,V as lt}from"./Immh241S.js";import{u as rt}from"./CPNNouYu.js";import{U as ne}from"./BB_Ol6Sd.js";import{u as ut}from"./aPBqHQcn.js";import{a as ct,d as dt,b as pt,c as ft}from"./DaX0k22-.js";import{d as Ee}from"./Cq9Fpw4b.js";const vt=()=>Pe&&/firefox/i.test(window.navigator.userAgent),mt=a=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(a);function ht(a){let u;function l(){if(a.value==null)return;const{selectionStart:i,selectionEnd:c,value:p}=a.value;if(i==null||c==null)return;const s=p.slice(0,Math.max(0,i)),r=p.slice(Math.max(0,c));u={selectionStart:i,selectionEnd:c,value:p,beforeTxt:s,afterTxt:r}}function o(){if(a.value==null||u==null)return;const{value:i}=a.value,{beforeTxt:c,afterTxt:p,selectionStart:s}=u;if(c==null||p==null||s==null)return;let r=i.length;if(i.endsWith(p))r=i.length-p.length;else if(i.startsWith(c))r=c.length;else{const b=c[s-1],x=i.indexOf(b,s-1);x!==-1&&(r=x+1)}a.value.setSelectionRange(r,r)}return[l,o]}function gt(a,{beforeFocus:u,afterFocus:l,beforeBlur:o,afterBlur:i}={}){const c=je(),{emit:p}=c,s=q(),r=L(!1),b=g=>{xe(u)&&u(g)||r.value||(r.value=!0,p("focus",g),l==null||l())},x=g=>{var E;xe(o)&&o(g)||g.relatedTarget&&((E=s.value)!=null&&E.contains(g.relatedTarget))||(r.value=!1,p("blur",g),i==null||i())},f=()=>{var g,E;(g=s.value)!=null&&g.contains(document.activeElement)&&s.value!==document.activeElement||(E=a.value)==null||E.focus()};return X(s,g=>{g&&g.setAttribute("tabindex","-1")}),oe(s,"focus",b,!0),oe(s,"blur",x,!0),oe(s,"click",f,!0),{isFocused:r,wrapperRef:s,handleFocus:b,handleBlur:x}}function yt({afterComposition:a,emit:u}){const l=L(!1),o=s=>{u==null||u("compositionstart",s),l.value=!0},i=s=>{var r;u==null||u("compositionupdate",s);const b=(r=s.target)==null?void 0:r.value,x=b[b.length-1]||"";l.value=!mt(x)},c=s=>{u==null||u("compositionend",s),l.value&&(l.value=!1,P(()=>a(s)))};return{isComposing:l,handleComposition:s=>{s.type==="compositionend"?c(s):i(s)},handleCompositionStart:o,handleCompositionUpdate:i,handleCompositionEnd:c}}let w;const bt=`
height:0 !important;
visibility:hidden !important;
${vt()?"":"overflow:hidden !important;"}
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
`,xt=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function wt(a){const u=window.getComputedStyle(a),l=u.getPropertyValue("box-sizing"),o=Number.parseFloat(u.getPropertyValue("padding-bottom"))+Number.parseFloat(u.getPropertyValue("padding-top")),i=Number.parseFloat(u.getPropertyValue("border-bottom-width"))+Number.parseFloat(u.getPropertyValue("border-top-width"));return{contextStyle:xt.map(p=>`${p}:${u.getPropertyValue(p)}`).join(";"),paddingSize:o,borderSize:i,boxSizing:l}}function ze(a,u=1,l){var o;w||(w=document.createElement("textarea"),document.body.appendChild(w));const{paddingSize:i,borderSize:c,boxSizing:p,contextStyle:s}=wt(a);w.setAttribute("style",`${s};${bt}`),w.value=a.value||a.placeholder||"";let r=w.scrollHeight;const b={};p==="border-box"?r=r+c:p==="content-box"&&(r=r-i),w.value="";const x=w.scrollHeight-i;if(Ce(u)){let f=x*u;p==="border-box"&&(f=f+i+c),r=Math.max(f,r),b.minHeight=`${f}px`}if(Ce(l)){let f=x*l;p==="border-box"&&(f=f+i+c),r=Math.min(f,r)}return b.height=`${r}px`,(o=w.parentNode)==null||o.removeChild(w),w=void 0,b}const Ct=Ze({id:{type:String,default:void 0},size:it,disabled:Boolean,modelValue:{type:ae([String,Number,Object]),default:""},maxlength:{type:[String,Number]},minlength:{type:[String,Number]},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:ae([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:Boolean,clearable:Boolean,showPassword:Boolean,showWordLimit:Boolean,suffixIcon:{type:Ie},prefixIcon:{type:Ie},containerRole:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:ae([Object,Array,String]),default:()=>Je({})},autofocus:Boolean,rows:{type:Number,default:2},...rt(["ariaLabel"])}),St={[ne]:a=>Z(a),input:a=>Z(a),change:a=>Z(a),focus:a=>a instanceof FocusEvent,blur:a=>a instanceof FocusEvent,clear:()=>!0,mouseleave:a=>a instanceof MouseEvent,mouseenter:a=>a instanceof MouseEvent,keydown:a=>a instanceof Event,compositionstart:a=>a instanceof CompositionEvent,compositionupdate:a=>a instanceof CompositionEvent,compositionend:a=>a instanceof CompositionEvent},It=ke({name:"ElInput",inheritAttrs:!1}),Et=ke({...It,props:Ct,emits:St,setup(a,{expose:u,emit:l}){const o=a,i=Ke(),c=We(),p=m(()=>{const e={};return o.containerRole==="combobox"&&(e["aria-haspopup"]=i["aria-haspopup"],e["aria-owns"]=i["aria-owns"],e["aria-expanded"]=i["aria-expanded"]),e}),s=m(()=>[o.type==="textarea"?se.b():n.b(),n.m(E.value),n.is("disabled",k.value),n.is("exceed",Te.value),{[n.b("group")]:c.prepend||c.append,[n.m("prefix")]:c.prefix||o.prefixIcon,[n.m("suffix")]:c.suffix||o.suffixIcon||o.clearable||o.showPassword,[n.bm("suffix","password-clear")]:K.value&&G.value,[n.b("hidden")]:o.type==="hidden"},i.class]),r=m(()=>[n.e("wrapper"),n.is("focus",j.value)]),b=ut({excludeKeys:m(()=>Object.keys(p.value))}),{form:x,formItem:f}=ct(),{inputId:g}=dt(o,{formItemContext:f}),E=pt(),k=ft(),n=Se("input"),se=Se("textarea"),H=q(),S=q(),_=L(!1),O=L(!1),ie=L(),D=q(o.inputStyle),F=m(()=>H.value||S.value),{wrapperRef:Fe,isFocused:j}=gt(F,{afterBlur(){var e;o.validateEvent&&((e=f==null?void 0:f.validate)==null||e.call(f,"blur").catch(d=>Ee()))}}),le=m(()=>{var e;return(e=x==null?void 0:x.statusIcon)!=null?e:!1}),$=m(()=>(f==null?void 0:f.validateState)||""),re=m(()=>$.value&&lt[$.value]),Ne=m(()=>O.value?et:tt),Ve=m(()=>[i.style]),ue=m(()=>[o.inputStyle,D.value,{resize:o.resize}]),z=m(()=>ot(o.modelValue)?"":String(o.modelValue)),K=m(()=>o.clearable&&!k.value&&!o.readonly&&!!z.value&&(j.value||_.value)),G=m(()=>o.showPassword&&!k.value&&!o.readonly&&!!z.value&&(!!z.value||j.value)),N=m(()=>o.showWordLimit&&!!o.maxlength&&(o.type==="text"||o.type==="textarea")&&!k.value&&!o.readonly&&!o.showPassword),J=m(()=>z.value.length),Te=m(()=>!!N.value&&J.value>Number(o.maxlength)),$e=m(()=>!!c.suffix||!!o.suffixIcon||K.value||o.showPassword||N.value||!!$.value&&le.value),[Me,Re]=ht(H);Qe(S,e=>{if(Be(),!N.value||o.resize!=="both")return;const d=e[0],{width:V}=d.contentRect;ie.value={right:`calc(100% - ${V+15+6}px)`}});const M=()=>{const{type:e,autosize:d}=o;if(!(!Pe||e!=="textarea"||!S.value))if(d){const V=we(d)?d.minRows:void 0,ye=we(d)?d.maxRows:void 0,be=ze(S.value,V,ye);D.value={overflowY:"hidden",...be},P(()=>{S.value.offsetHeight,D.value=be})}else D.value={minHeight:ze(S.value).minHeight}},Be=(e=>{let d=!1;return()=>{var V;if(d||!o.autosize)return;((V=S.value)==null?void 0:V.offsetParent)===null||(e(),d=!0)}})(M),R=()=>{const e=F.value,d=o.formatter?o.formatter(z.value):z.value;!e||e.value===d||(e.value=d)},Q=async e=>{Me();let{value:d}=e.target;if(o.formatter&&(d=o.parser?o.parser(d):d),!de.value){if(d===z.value){R();return}l(ne,d),l("input",d),await P(),R(),Re()}},ce=e=>{l("change",e.target.value)},{isComposing:de,handleCompositionStart:pe,handleCompositionUpdate:fe,handleCompositionEnd:ve}=yt({emit:l,afterComposition:Q}),Ae=()=>{O.value=!O.value,me()},me=async()=>{var e;await P(),(e=F.value)==null||e.focus()},Le=()=>{var e;return(e=F.value)==null?void 0:e.blur()},He=e=>{_.value=!1,l("mouseleave",e)},Oe=e=>{_.value=!0,l("mouseenter",e)},he=e=>{l("keydown",e)},De=()=>{var e;(e=F.value)==null||e.select()},ge=()=>{l(ne,""),l("change",""),l("clear"),l("input","")};return X(()=>o.modelValue,()=>{var e;P(()=>M()),o.validateEvent&&((e=f==null?void 0:f.validate)==null||e.call(f,"change").catch(d=>Ee()))}),X(z,()=>R()),X(()=>o.type,async()=>{await P(),R(),M()}),Ue(()=>{!o.formatter&&o.parser,R(),P(M)}),u({input:H,textarea:S,ref:F,textareaStyle:ue,autosize:Ye(o,"autosize"),isComposing:de,focus:me,blur:Le,select:De,clear:ge,resizeTextarea:M}),(e,d)=>(v(),C("div",te(t(p),{class:[t(s),{[t(n).bm("group","append")]:e.$slots.append,[t(n).bm("group","prepend")]:e.$slots.prepend}],style:t(Ve),role:e.containerRole,onMouseenter:Oe,onMouseleave:He}),[h(" input "),e.type!=="textarea"?(v(),C(ee,{key:0},[h(" prepend slot "),e.$slots.prepend?(v(),C("div",{key:0,class:y(t(n).be("group","prepend"))},[W(e.$slots,"prepend")],2)):h("v-if",!0),T("div",{ref_key:"wrapperRef",ref:Fe,class:y(t(r))},[h(" prefix slot "),e.$slots.prefix||e.prefixIcon?(v(),C("span",{key:0,class:y(t(n).e("prefix"))},[T("span",{class:y(t(n).e("prefix-inner"))},[W(e.$slots,"prefix"),e.prefixIcon?(v(),I(t(A),{key:0,class:y(t(n).e("icon"))},{default:B(()=>[(v(),I(U(e.prefixIcon)))]),_:1},8,["class"])):h("v-if",!0)],2)],2)):h("v-if",!0),T("input",te({id:t(g),ref_key:"input",ref:H,class:t(n).e("inner")},t(b),{minlength:e.minlength,maxlength:e.maxlength,type:e.showPassword?O.value?"text":"password":e.type,disabled:t(k),readonly:e.readonly,autocomplete:e.autocomplete,tabindex:e.tabindex,"aria-label":e.ariaLabel,placeholder:e.placeholder,style:e.inputStyle,form:e.form,autofocus:e.autofocus,onCompositionstart:t(pe),onCompositionupdate:t(fe),onCompositionend:t(ve),onInput:Q,onChange:ce,onKeydown:he}),null,16,["id","minlength","maxlength","type","disabled","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus","onCompositionstart","onCompositionupdate","onCompositionend"]),h(" suffix slot "),t($e)?(v(),C("span",{key:1,class:y(t(n).e("suffix"))},[T("span",{class:y(t(n).e("suffix-inner"))},[!t(K)||!t(G)||!t(N)?(v(),C(ee,{key:0},[W(e.$slots,"suffix"),e.suffixIcon?(v(),I(t(A),{key:0,class:y(t(n).e("icon"))},{default:B(()=>[(v(),I(U(e.suffixIcon)))]),_:1},8,["class"])):h("v-if",!0)],64)):h("v-if",!0),t(K)?(v(),I(t(A),{key:1,class:y([t(n).e("icon"),t(n).e("clear")]),onMousedown:Xe(t(_e),["prevent"]),onClick:ge},{default:B(()=>[qe(t(at))]),_:1},8,["class","onMousedown"])):h("v-if",!0),t(G)?(v(),I(t(A),{key:2,class:y([t(n).e("icon"),t(n).e("password")]),onClick:Ae},{default:B(()=>[(v(),I(U(t(Ne))))]),_:1},8,["class"])):h("v-if",!0),t(N)?(v(),C("span",{key:3,class:y(t(n).e("count"))},[T("span",{class:y(t(n).e("count-inner"))},Y(t(J))+" / "+Y(e.maxlength),3)],2)):h("v-if",!0),t($)&&t(re)&&t(le)?(v(),I(t(A),{key:4,class:y([t(n).e("icon"),t(n).e("validateIcon"),t(n).is("loading",t($)==="validating")])},{default:B(()=>[(v(),I(U(t(re))))]),_:1},8,["class"])):h("v-if",!0)],2)],2)):h("v-if",!0)],2),h(" append slot "),e.$slots.append?(v(),C("div",{key:1,class:y(t(n).be("group","append"))},[W(e.$slots,"append")],2)):h("v-if",!0)],64)):(v(),C(ee,{key:1},[h(" textarea "),T("textarea",te({id:t(g),ref_key:"textarea",ref:S,class:[t(se).e("inner"),t(n).is("focus",t(j))]},t(b),{minlength:e.minlength,maxlength:e.maxlength,tabindex:e.tabindex,disabled:t(k),readonly:e.readonly,autocomplete:e.autocomplete,style:t(ue),"aria-label":e.ariaLabel,placeholder:e.placeholder,form:e.form,autofocus:e.autofocus,rows:e.rows,onCompositionstart:t(pe),onCompositionupdate:t(fe),onCompositionend:t(ve),onInput:Q,onChange:ce,onKeydown:he}),null,16,["id","minlength","maxlength","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus","rows","onCompositionstart","onCompositionupdate","onCompositionend"]),t(N)?(v(),C("span",{key:0,style:Ge(ie.value),class:y(t(n).e("count"))},Y(t(J))+" / "+Y(e.maxlength),7)):h("v-if",!0)],64))],16,["role"]))}});var zt=nt(Et,[["__file","input.vue"]]);const Lt=st(zt);export{Lt as E,gt as a,yt as u};