| 1 |
- import{d as O,c as te,o as h,a as ae,n as Le,b as le,e as v,p as _,s as b,q as oe,j as k,u as re,w as Se,D as m,C as W,I as Ve,L as Ee,_ as Pe,A as w,m as P,H as J,r as Oe}from"./vue-vendor-BdC0yijC.js";import{a as H,c as q,d as ze,aF as Fe,ao as Me,aG as Ne,Q as Ae,aw as Re,ax as Te,e as x,o as je,aO as X,a6 as We,a1 as se,a0 as De,i as ie,aP as He,av as qe,aj as ue}from"./index-CKglxn7a.js";import{u as Ke}from"./use-merge-state-DwhVbGFg.js";const Ue=O({name:"IconEyeInvisible",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:e=>["butt","round","square"].includes(e)},strokeLinejoin:{type:String,default:"miter",validator:e=>["arcs","bevel","miter","miter-clip","round"].includes(e)},rotate:Number,spin:Boolean},emits:{click:e=>!0},setup(e,{emit:n}){const a=q("icon"),i=v(()=>[a,`${a}-eye-invisible`,{[`${a}-spin`]:e.spin}]),l=v(()=>{const o={};return e.size&&(o.fontSize=ze(e.size)?`${e.size}px`:e.size),e.rotate&&(o.transform=`rotate(${e.rotate}deg)`),o});return{cls:i,innerStyle:l,onClick:o=>{n("click",o)}}}}),Ge=["stroke-width","stroke-linecap","stroke-linejoin"],Qe=ae("path",{d:"M14 14.5c-2.69 2-5.415 5.33-8 9.5 5.373 8.667 11.373 13 18 13 3.325 0 6.491-1.09 9.5-3.271M17.463 12.5C19 11 21.75 11 24 11c6.627 0 12.627 4.333 18 13-1.766 2.848-3.599 5.228-5.5 7.14"},null,-1),Ze=ae("path",{d:"M29 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0ZM6.852 7.103l34.294 34.294"},null,-1),Je=[Qe,Ze];function Xe(e,n,a,i,l,u){return h(),te("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:le(e.cls),style:Le(e.innerStyle),"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeLinecap,"stroke-linejoin":e.strokeLinejoin,onClick:n[0]||(n[0]=(...o)=>e.onClick&&e.onClick(...o))},Je,14,Ge)}var D=H(Ue,[["render",Xe]]);const Ye=Object.assign(D,{install:(e,n)=>{var a;const i=(a=n==null?void 0:n.iconPrefix)!=null?a:"";e.component(i+D.name,D)}}),en=O({name:"FeedbackIcon",components:{IconLoading:Ae,IconCheckCircleFill:Ne,IconExclamationCircleFill:Me,IconCloseCircleFill:Fe},props:{type:{type:String}},setup(e){const n=q("feedback-icon");return{cls:v(()=>[n,`${n}-status-${e.type}`])}}});function nn(e,n,a,i,l,u){const o=_("icon-loading"),f=_("icon-check-circle-fill"),r=_("icon-exclamation-circle-fill"),c=_("icon-close-circle-fill");return h(),te("span",{class:le(e.cls)},[e.type==="validating"?(h(),b(o,{key:0})):e.type==="success"?(h(),b(f,{key:1})):e.type==="warning"?(h(),b(r,{key:2})):e.type==="error"?(h(),b(c,{key:3})):oe("v-if",!0)],2)}var tn=H(en,[["render",nn]]);const an={key:"Enter"},hn={key:"Backspace"};function ln(e,n){const a={};return n.forEach(i=>{const l=i;i in e&&(a[l]=e[l])}),a}function on(e){const n=k();function a(){if(!e.value)return;const{selectionStart:l,selectionEnd:u,value:o}=e.value;if(l==null||u==null)return;const f=o.slice(0,Math.max(0,l)),r=o.slice(Math.max(0,u));n.value={selectionStart:l,selectionEnd:u,value:o,beforeTxt:f,afterTxt:r}}function i(){if(!e.value||!n.value)return;const{value:l}=e.value,{beforeTxt:u,afterTxt:o,selectionStart:f}=n.value;if(!u||!o||!f)return;let r=l.length;if(l.endsWith(o))r=l.length-o.length;else if(l.startsWith(u))r=u.length;else{const c=u[f-1],I=l.indexOf(c,f-1);I!==-1&&(r=I+1)}e.value.setSelectionRange(r,r)}return[a,i]}var rn=Object.defineProperty,Y=Object.getOwnPropertySymbols,sn=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,ee=(e,n,a)=>n in e?rn(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a,ne=(e,n)=>{for(var a in n||(n={}))sn.call(n,a)&&ee(e,a,n[a]);if(Y)for(var a of Y(n))un.call(n,a)&&ee(e,a,n[a]);return e},cn=O({name:"Input",inheritAttrs:!1,props:{modelValue:String,defaultValue:{type:String,default:""},size:{type:String},allowClear:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},error:{type:Boolean,default:!1},placeholder:String,maxLength:{type:[Number,Object],default:0},showWordLimit:{type:Boolean,default:!1},wordLength:{type:Function},wordSlice:{type:Function},inputAttrs:{type:Object},type:{type:String,default:"text"}},emits:{"update:modelValue":e=>!0,input:(e,n)=>!0,change:(e,n)=>!0,pressEnter:e=>!0,clear:e=>!0,focus:e=>!0,blur:e=>!0},setup(e,{emit:n,slots:a,attrs:i}){const{size:l,disabled:u,error:o,modelValue:f}=re(e),r=q("input"),c=k(),{mergedSize:I,mergedDisabled:B,mergedError:ce,feedback:L,eventHandlers:$}=Re({size:l,disabled:u,error:o}),{mergedSize:K}=Te(I),[de,ve]=on(c),z=k(e.defaultValue),y=v(()=>{var t;return(t=e.modelValue)!=null?t:z.value});Se(f,t=>{(ie(t)||He(t))&&(z.value="")});let F=y.value;const M=k(!1),fe=v(()=>e.allowClear&&!e.readonly&&!B.value&&!!y.value),S=k(!1),U=k(""),C=t=>{var s;return We(e.wordLength)?e.wordLength(t):(s=t.length)!=null?s:0},V=v(()=>C(y.value)),G=v(()=>ce.value||!!(x(e.maxLength)&&e.maxLength.errorOnly&&V.value>p.value)),N=v(()=>x(e.maxLength)&&!!e.maxLength.errorOnly),p=v(()=>x(e.maxLength)?e.maxLength.length:e.maxLength),pe=v(()=>{const t=C("a");return Math.floor(p.value/t)}),A=t=>{var s,d;p.value&&!N.value&&C(t)>p.value&&(t=(d=(s=e.wordSlice)==null?void 0:s.call(e,t,p.value))!=null?d:t.slice(0,pe.value)),z.value=t,n("update:modelValue",t)},me=t=>{c.value&&t.target!==c.value&&(t.preventDefault(),c.value.focus())},R=(t,s)=>{var d,g;t!==F&&(F=t,n("change",t,s),(g=(d=$.value)==null?void 0:d.onChange)==null||g.call(d,s))},ye=t=>{var s,d;M.value=!0,F=y.value,n("focus",t),(d=(s=$.value)==null?void 0:s.onFocus)==null||d.call(s,t)},he=t=>{var s,d;M.value=!1,R(y.value,t),n("blur",t),(d=(s=$.value)==null?void 0:s.onBlur)==null||d.call(s,t)},T=t=>{var s,d,g;const{value:j,selectionStart:Ie,selectionEnd:Be}=t.target;if(t.type==="compositionend"){if(S.value=!1,U.value="",p.value&&!N.value&&V.value>=p.value&&C(j)>p.value&&Ie===Be){E();return}A(j),n("input",j,t),(d=(s=$.value)==null?void 0:s.onInput)==null||d.call(s,t),E()}else S.value=!0,U.value=y.value+((g=t.data)!=null?g:"")},E=()=>{de(),Ee(()=>{c.value&&y.value!==c.value.value&&(c.value.value=y.value,ve())})},ge=t=>{var s,d;const{value:g}=t.target;if(!S.value){if(p.value&&!N.value&&V.value>=p.value&&C(g)>p.value&&t.inputType==="insertText"){E();return}A(g),n("input",g,t),(d=(s=$.value)==null?void 0:s.onInput)==null||d.call(s,t),E()}},_e=t=>{A(""),R("",t),n("clear",t)},be=t=>{const s=t.key||t.code;!S.value&&s===an.key&&(R(y.value,t),n("pressEnter",t))},ke=v(()=>[`${r}-outer`,`${r}-outer-size-${K.value}`,{[`${r}-outer-has-suffix`]:!!a.suffix,[`${r}-outer-disabled`]:B.value}]),$e=v(()=>[`${r}-wrapper`,{[`${r}-error`]:G.value,[`${r}-disabled`]:B.value,[`${r}-focus`]:M.value}]),Ce=v(()=>[r,`${r}-size-${K.value}`]),Q=v(()=>je(i,X)),we=v(()=>ln(i,X)),xe=v(()=>{const t=ne(ne({},we.value),e.inputAttrs);return G.value&&(t["aria-invalid"]=!0),t}),Z=t=>{var s;return m("span",W({class:$e.value,onMousedown:me},t?void 0:Q.value),[a.prefix&&m("span",{class:`${r}-prefix`},[a.prefix()]),m("input",W({ref:c,class:Ce.value,value:y.value,type:e.type,placeholder:e.placeholder,readonly:e.readonly,disabled:B.value,onInput:ge,onKeydown:be,onFocus:ye,onBlur:he,onCompositionstart:T,onCompositionupdate:T,onCompositionend:T},xe.value),null),fe.value&&m(se,{prefix:r,class:`${r}-clear-btn`,onClick:_e},{default:()=>[m(De,null,null)]}),(a.suffix||!!e.maxLength&&e.showWordLimit||!!L.value)&&m("span",{class:[`${r}-suffix`,{[`${r}-suffix-has-feedback`]:L.value}]},[!!e.maxLength&&e.showWordLimit&&m("span",{class:`${r}-word-limit`},[V.value,Ve("/"),p.value]),(s=a.suffix)==null?void 0:s.call(a),!!L.value&&m(tn,{type:L.value},null)])])};return{inputRef:c,render:()=>a.prepend||a.append?m("span",W({class:ke.value},Q.value),[a.prepend&&m("span",{class:`${r}-prepend`},[a.prepend()]),Z(!0),a.append&&m("span",{class:`${r}-append`},[a.append()])]):Z()}},methods:{focus(){var e;(e=this.inputRef)==null||e.focus()},blur(){var e;(e=this.inputRef)==null||e.blur()}},render(){return this.render()}});const dn=O({name:"InputPassword",components:{IconEye:qe,IconEyeInvisible:Ye,AIconHover:se,AInput:cn},props:{visibility:{type:Boolean,default:void 0},defaultVisibility:{type:Boolean,default:!0},invisibleButton:{type:Boolean,default:!0}},emits:["visibility-change","update:visibility"],setup(e,{emit:n}){const{visibility:a,defaultVisibility:i}=re(e),l=k(),u=()=>{r(!o.value)},[o,f]=Ke(i.value,Oe({value:a})),r=c=>{c!==o.value&&(n("visibility-change",c),n("update:visibility",c),f(c))};return{inputRef:l,mergedVisible:o,handleInvisible:u}},methods:{focus(){var e;(e=this.inputRef)==null||e.focus()},blur(){var e;(e=this.inputRef)==null||e.blur()}}});function vn(e,n,a,i,l,u){const o=_("icon-eye"),f=_("icon-eye-invisible"),r=_("a-icon-hover"),c=_("a-input");return h(),b(c,{ref:"inputRef",type:e.mergedVisible?"password":"text"},Pe({_:2},[e.$slots.prepend?{name:"prepend",fn:w(()=>[P(e.$slots,"prepend")])}:void 0,e.$slots.prefix?{name:"prefix",fn:w(()=>[P(e.$slots,"prefix")])}:void 0,e.invisibleButton||e.$slots.suffix?{name:"suffix",fn:w(()=>[e.invisibleButton?(h(),b(r,{key:0,onClick:e.handleInvisible,onMousedown:n[0]||(n[0]=J(()=>{},["prevent"])),onMouseup:n[1]||(n[1]=J(()=>{},["prevent"]))},{default:w(()=>[e.mergedVisible?(h(),b(f,{key:1})):(h(),b(o,{key:0}))]),_:1},8,["onClick"])):oe("v-if",!0),P(e.$slots,"suffix")])}:void 0,e.$slots.append?{name:"append",fn:w(()=>[P(e.$slots,"append")])}:void 0]),1032,["type"])}var gn=H(dn,[["render",vn]]);const _n=(e,n)=>{if(!e||!n)return;n=n.replace(/\[(\w+)\]/g,".$1");const a=n.split(".");if(a.length===0)return;let i=e;for(let l=0;l<a.length;l++){if(!x(i)&&!ue(i)||!a[l])return;if(l!==a.length-1)i=i[a[l]];else return i[a[l]]}},bn=(e,n,a,{addPath:i}={})=>{if(!e||!n)return;n=n.replace(/\[(\w+)\]/g,".$1");const l=n.split(".");if(l.length===0)return;let u=e;for(let o=0;o<l.length;o++){if(!x(u)&&!ue(u)||!l[o])return;o!==l.length-1?(i&&ie(u[l[o]])&&(u[l[o]]={}),u=u[l[o]]):u[l[o]]=a}};export{hn as B,an as E,tn as F,gn as I,cn as _,_n as g,ln as p,bn as s,on as u};
|