258 lines
32 KiB
JavaScript
258 lines
32 KiB
JavaScript
import{B as k,H as t,ai as lr,as as x,ar as C,au as l,bg as ir,bV as _e,b as de,bh as sr,b4 as j,b2 as oe,bi as cr,z as ur,r as w,w as he,c as dr,j as R,bM as hr,av as z,at as K,ay as Ae,ax as fr,b$ as vr,aI as pr,bF as gr,A as me,s as br,q as xr,az as we,D as mr,b0 as wr,aC as yr,aG as Q,b8 as Cr,F as zr,bf as Sr,aO as _r,n as ye,v as Ce,aL as y,aY as ue,b1 as Ar,y as ze}from"./_plugin-vue_export-helper.js";import{u as Fr}from"./use-locale.js";const Rr=k({name:"Eye",render(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"}),t("circle",{cx:"256",cy:"256",r:"80",fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32"}))}}),Br=k({name:"EyeOff",render(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t("path",{d:"M432 448a15.92 15.92 0 0 1-11.31-4.69l-352-352a16 16 0 0 1 22.62-22.62l352 352A16 16 0 0 1 432 448z",fill:"currentColor"}),t("path",{d:"M255.66 384c-41.49 0-81.5-12.28-118.92-36.5c-34.07-22-64.74-53.51-88.7-91v-.08c19.94-28.57 41.78-52.73 65.24-72.21a2 2 0 0 0 .14-2.94L93.5 161.38a2 2 0 0 0-2.71-.12c-24.92 21-48.05 46.76-69.08 76.92a31.92 31.92 0 0 0-.64 35.54c26.41 41.33 60.4 76.14 98.28 100.65C162 402 207.9 416 255.66 416a239.13 239.13 0 0 0 75.8-12.58a2 2 0 0 0 .77-3.31l-21.58-21.58a4 4 0 0 0-3.83-1a204.8 204.8 0 0 1-51.16 6.47z",fill:"currentColor"}),t("path",{d:"M490.84 238.6c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.66 96a227.34 227.34 0 0 0-74.89 12.83a2 2 0 0 0-.75 3.31l21.55 21.55a4 4 0 0 0 3.88 1a192.82 192.82 0 0 1 50.21-6.69c40.69 0 80.58 12.43 118.55 37c34.71 22.4 65.74 53.88 89.76 91a.13.13 0 0 1 0 .16a310.72 310.72 0 0 1-64.12 72.73a2 2 0 0 0-.15 2.95l19.9 19.89a2 2 0 0 0 2.7.13a343.49 343.49 0 0 0 68.64-78.48a32.2 32.2 0 0 0-.1-34.78z",fill:"currentColor"}),t("path",{d:"M256 160a95.88 95.88 0 0 0-21.37 2.4a2 2 0 0 0-1 3.38l112.59 112.56a2 2 0 0 0 3.38-1A96 96 0 0 0 256 160z",fill:"currentColor"}),t("path",{d:"M165.78 233.66a2 2 0 0 0-3.38 1a96 96 0 0 0 115 115a2 2 0 0 0 1-3.38z",fill:"currentColor"}))}}),$r=k({name:"ChevronDown",render(){return t("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z",fill:"currentColor"}))}}),Pr=lr("clear",t("svg",{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},t("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},t("g",{fill:"currentColor","fill-rule":"nonzero"},t("path",{d:"M8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 C2,4.6862915 4.6862915,2 8,2 Z M6.5343055,5.83859116 C6.33943736,5.70359511 6.07001296,5.72288026 5.89644661,5.89644661 L5.89644661,5.89644661 L5.83859116,5.9656945 C5.70359511,6.16056264 5.72288026,6.42998704 5.89644661,6.60355339 L5.89644661,6.60355339 L7.293,8 L5.89644661,9.39644661 L5.83859116,9.4656945 C5.70359511,9.66056264 5.72288026,9.92998704 5.89644661,10.1035534 L5.89644661,10.1035534 L5.9656945,10.1614088 C6.16056264,10.2964049 6.42998704,10.2771197 6.60355339,10.1035534 L6.60355339,10.1035534 L8,8.707 L9.39644661,10.1035534 L9.4656945,10.1614088 C9.66056264,10.2964049 9.92998704,10.2771197 10.1035534,10.1035534 L10.1035534,10.1035534 L10.1614088,10.0343055 C10.2964049,9.83943736 10.2771197,9.57001296 10.1035534,9.39644661 L10.1035534,9.39644661 L8.707,8 L10.1035534,6.60355339 L10.1614088,6.5343055 C10.2964049,6.33943736 10.2771197,6.07001296 10.1035534,5.89644661 L10.1035534,5.89644661 L10.0343055,5.83859116 C9.83943736,5.70359511 9.57001296,5.72288026 9.39644661,5.89644661 L9.39644661,5.89644661 L8,7.293 L6.60355339,5.89644661 Z"}))))),Er=x("base-clear",`
|
|
flex-shrink: 0;
|
|
height: 1em;
|
|
width: 1em;
|
|
position: relative;
|
|
`,[C(">",[l("clear",`
|
|
font-size: var(--n-clear-size);
|
|
height: 1em;
|
|
width: 1em;
|
|
cursor: pointer;
|
|
color: var(--n-clear-color);
|
|
transition: color .3s var(--n-bezier);
|
|
display: flex;
|
|
`,[C("&:hover",`
|
|
color: var(--n-clear-color-hover)!important;
|
|
`),C("&:active",`
|
|
color: var(--n-clear-color-pressed)!important;
|
|
`)]),l("placeholder",`
|
|
display: flex;
|
|
`),l("clear, placeholder",`
|
|
position: absolute;
|
|
left: 50%;
|
|
top: 50%;
|
|
transform: translateX(-50%) translateY(-50%);
|
|
`,[ir({originalTransform:"translateX(-50%) translateY(-50%)",left:"50%",top:"50%"})])])]),fe=k({name:"BaseClear",props:{clsPrefix:{type:String,required:!0},show:Boolean,onClear:Function},setup(r){return _e("-base-clear",Er,de(r,"clsPrefix")),{handleMouseDown(v){v.preventDefault()}}},render(){const{clsPrefix:r}=this;return t("div",{class:`${r}-base-clear`},t(sr,null,{default:()=>{var v,n;return this.show?t("div",{key:"dismiss",class:`${r}-base-clear__clear`,onClick:this.onClear,onMousedown:this.handleMouseDown,"data-clear":!0},j(this.$slots.icon,()=>[t(oe,{clsPrefix:r},{default:()=>t(Pr,null)})])):t("div",{key:"icon",class:`${r}-base-clear__placeholder`},(n=(v=this.$slots).placeholder)===null||n===void 0?void 0:n.call(v))}}))}}),kr=k({name:"InternalSelectionSuffix",props:{clsPrefix:{type:String,required:!0},showArrow:{type:Boolean,default:void 0},showClear:{type:Boolean,default:void 0},loading:{type:Boolean,default:!1},onClear:Function},setup(r,{slots:v}){return()=>{const{clsPrefix:n}=r;return t(cr,{clsPrefix:n,class:`${n}-base-suffix`,strokeWidth:24,scale:.85,show:r.loading},{default:()=>r.showArrow?t(fe,{clsPrefix:n,show:r.showClear,onClear:r.onClear},{placeholder:()=>t(oe,{clsPrefix:n,class:`${n}-base-suffix__arrow`},{default:()=>j(v.default,()=>[t($r,null)])})}):null})}}}),Fe=ur("n-input");function Ir(r){let v=0;for(const n of r)v++;return v}function ee(r){return r===""||r==null}function Tr(r){const v=w(null);function n(){const{value:b}=r;if(!(b!=null&&b.focus)){A();return}const{selectionStart:h,selectionEnd:s,value:u}=b;if(h==null||s==null){A();return}v.value={start:h,end:s,beforeText:u.slice(0,h),afterText:u.slice(s)}}function _(){var b;const{value:h}=v,{value:s}=r;if(!h||!s)return;const{value:u}=s,{start:c,beforeText:i,afterText:g}=h;let m=u.length;if(u.endsWith(g))m=u.length-g.length;else if(u.startsWith(i))m=i.length;else{const I=i[c-1],S=u.indexOf(I,c-1);S!==-1&&(m=S+1)}(b=s.setSelectionRange)===null||b===void 0||b.call(s,m,m)}function A(){v.value=null}return he(r,A),{recordCursor:n,restoreCursor:_}}const Se=k({name:"InputWordCount",setup(r,{slots:v}){const{mergedValueRef:n,maxlengthRef:_,mergedClsPrefixRef:A,countGraphemesRef:b}=dr(Fe),h=R(()=>{const{value:s}=n;return s===null||Array.isArray(s)?0:(b.value||Ir)(s)});return()=>{const{value:s}=_,{value:u}=n;return t("span",{class:`${A.value}-input-word-count`},hr(v.default,{value:u===null||Array.isArray(u)?"":u},()=>[s===void 0?h.value:`${h.value} / ${s}`]))}}}),Mr=x("input",`
|
|
max-width: 100%;
|
|
cursor: text;
|
|
line-height: 1.5;
|
|
z-index: auto;
|
|
outline: none;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
display: inline-flex;
|
|
border-radius: var(--n-border-radius);
|
|
background-color: var(--n-color);
|
|
transition: background-color .3s var(--n-bezier);
|
|
font-size: var(--n-font-size);
|
|
--n-padding-vertical: calc((var(--n-height) - 1.5 * var(--n-font-size)) / 2);
|
|
`,[l("input, textarea",`
|
|
overflow: hidden;
|
|
flex-grow: 1;
|
|
position: relative;
|
|
`),l("input-el, textarea-el, input-mirror, textarea-mirror, separator, placeholder",`
|
|
box-sizing: border-box;
|
|
font-size: inherit;
|
|
line-height: 1.5;
|
|
font-family: inherit;
|
|
border: none;
|
|
outline: none;
|
|
background-color: #0000;
|
|
text-align: inherit;
|
|
transition:
|
|
-webkit-text-fill-color .3s var(--n-bezier),
|
|
caret-color .3s var(--n-bezier),
|
|
color .3s var(--n-bezier),
|
|
text-decoration-color .3s var(--n-bezier);
|
|
`),l("input-el, textarea-el",`
|
|
-webkit-appearance: none;
|
|
scrollbar-width: none;
|
|
width: 100%;
|
|
min-width: 0;
|
|
text-decoration-color: var(--n-text-decoration-color);
|
|
color: var(--n-text-color);
|
|
caret-color: var(--n-caret-color);
|
|
background-color: transparent;
|
|
`,[C("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb",`
|
|
width: 0;
|
|
height: 0;
|
|
display: none;
|
|
`),C("&::placeholder",`
|
|
color: #0000;
|
|
-webkit-text-fill-color: transparent !important;
|
|
`),C("&:-webkit-autofill ~",[l("placeholder","display: none;")])]),z("round",[K("textarea","border-radius: calc(var(--n-height) / 2);")]),l("placeholder",`
|
|
pointer-events: none;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
overflow: hidden;
|
|
color: var(--n-placeholder-color);
|
|
`,[C("span",`
|
|
width: 100%;
|
|
display: inline-block;
|
|
`)]),z("textarea",[l("placeholder","overflow: visible;")]),K("autosize","width: 100%;"),z("autosize",[l("textarea-el, input-el",`
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100%;
|
|
`)]),x("input-wrapper",`
|
|
overflow: hidden;
|
|
display: inline-flex;
|
|
flex-grow: 1;
|
|
position: relative;
|
|
padding-left: var(--n-padding-left);
|
|
padding-right: var(--n-padding-right);
|
|
`),l("input-mirror",`
|
|
padding: 0;
|
|
height: var(--n-height);
|
|
line-height: var(--n-height);
|
|
overflow: hidden;
|
|
visibility: hidden;
|
|
position: static;
|
|
white-space: pre;
|
|
pointer-events: none;
|
|
`),l("input-el",`
|
|
padding: 0;
|
|
height: var(--n-height);
|
|
line-height: var(--n-height);
|
|
`,[C("&[type=password]::-ms-reveal","display: none;"),C("+",[l("placeholder",`
|
|
display: flex;
|
|
align-items: center;
|
|
`)])]),K("textarea",[l("placeholder","white-space: nowrap;")]),l("eye",`
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: color .3s var(--n-bezier);
|
|
`),z("textarea","width: 100%;",[x("input-word-count",`
|
|
position: absolute;
|
|
right: var(--n-padding-right);
|
|
bottom: var(--n-padding-vertical);
|
|
`),z("resizable",[x("input-wrapper",`
|
|
resize: vertical;
|
|
min-height: var(--n-height);
|
|
`)]),l("textarea-el, textarea-mirror, placeholder",`
|
|
height: 100%;
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
padding-top: var(--n-padding-vertical);
|
|
padding-bottom: var(--n-padding-vertical);
|
|
word-break: break-word;
|
|
display: inline-block;
|
|
vertical-align: bottom;
|
|
box-sizing: border-box;
|
|
line-height: var(--n-line-height-textarea);
|
|
margin: 0;
|
|
resize: none;
|
|
white-space: pre-wrap;
|
|
scroll-padding-block-end: var(--n-padding-vertical);
|
|
`),l("textarea-mirror",`
|
|
width: 100%;
|
|
pointer-events: none;
|
|
overflow: hidden;
|
|
visibility: hidden;
|
|
position: static;
|
|
white-space: pre-wrap;
|
|
overflow-wrap: break-word;
|
|
`)]),z("pair",[l("input-el, placeholder","text-align: center;"),l("separator",`
|
|
display: flex;
|
|
align-items: center;
|
|
transition: color .3s var(--n-bezier);
|
|
color: var(--n-text-color);
|
|
white-space: nowrap;
|
|
`,[x("icon",`
|
|
color: var(--n-icon-color);
|
|
`),x("base-icon",`
|
|
color: var(--n-icon-color);
|
|
`)])]),z("disabled",`
|
|
cursor: not-allowed;
|
|
background-color: var(--n-color-disabled);
|
|
`,[l("border","border: var(--n-border-disabled);"),l("input-el, textarea-el",`
|
|
cursor: not-allowed;
|
|
color: var(--n-text-color-disabled);
|
|
text-decoration-color: var(--n-text-color-disabled);
|
|
`),l("placeholder","color: var(--n-placeholder-color-disabled);"),l("separator","color: var(--n-text-color-disabled);",[x("icon",`
|
|
color: var(--n-icon-color-disabled);
|
|
`),x("base-icon",`
|
|
color: var(--n-icon-color-disabled);
|
|
`)]),x("input-word-count",`
|
|
color: var(--n-count-text-color-disabled);
|
|
`),l("suffix, prefix","color: var(--n-text-color-disabled);",[x("icon",`
|
|
color: var(--n-icon-color-disabled);
|
|
`),x("internal-icon",`
|
|
color: var(--n-icon-color-disabled);
|
|
`)])]),K("disabled",[l("eye",`
|
|
color: var(--n-icon-color);
|
|
cursor: pointer;
|
|
`,[C("&:hover",`
|
|
color: var(--n-icon-color-hover);
|
|
`),C("&:active",`
|
|
color: var(--n-icon-color-pressed);
|
|
`)]),C("&:hover",[l("state-border","border: var(--n-border-hover);")]),z("focus","background-color: var(--n-color-focus);",[l("state-border",`
|
|
border: var(--n-border-focus);
|
|
box-shadow: var(--n-box-shadow-focus);
|
|
`)])]),l("border, state-border",`
|
|
box-sizing: border-box;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
pointer-events: none;
|
|
border-radius: inherit;
|
|
border: var(--n-border);
|
|
transition:
|
|
box-shadow .3s var(--n-bezier),
|
|
border-color .3s var(--n-bezier);
|
|
`),l("state-border",`
|
|
border-color: #0000;
|
|
z-index: 1;
|
|
`),l("prefix","margin-right: 4px;"),l("suffix",`
|
|
margin-left: 4px;
|
|
`),l("suffix, prefix",`
|
|
transition: color .3s var(--n-bezier);
|
|
flex-wrap: nowrap;
|
|
flex-shrink: 0;
|
|
line-height: var(--n-height);
|
|
white-space: nowrap;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--n-suffix-text-color);
|
|
`,[x("base-loading",`
|
|
font-size: var(--n-icon-size);
|
|
margin: 0 2px;
|
|
color: var(--n-loading-color);
|
|
`),x("base-clear",`
|
|
font-size: var(--n-icon-size);
|
|
`,[l("placeholder",[x("base-icon",`
|
|
transition: color .3s var(--n-bezier);
|
|
color: var(--n-icon-color);
|
|
font-size: var(--n-icon-size);
|
|
`)])]),C(">",[x("icon",`
|
|
transition: color .3s var(--n-bezier);
|
|
color: var(--n-icon-color);
|
|
font-size: var(--n-icon-size);
|
|
`)]),x("base-icon",`
|
|
font-size: var(--n-icon-size);
|
|
`)]),x("input-word-count",`
|
|
pointer-events: none;
|
|
line-height: 1.5;
|
|
font-size: .85em;
|
|
color: var(--n-count-text-color);
|
|
transition: color .3s var(--n-bezier);
|
|
margin-left: 4px;
|
|
font-variant: tabular-nums;
|
|
`),["warning","error"].map(r=>z(`${r}-status`,[K("disabled",[x("base-loading",`
|
|
color: var(--n-loading-color-${r})
|
|
`),l("input-el, textarea-el",`
|
|
caret-color: var(--n-caret-color-${r});
|
|
`),l("state-border",`
|
|
border: var(--n-border-${r});
|
|
`),C("&:hover",[l("state-border",`
|
|
border: var(--n-border-hover-${r});
|
|
`)]),C("&:focus",`
|
|
background-color: var(--n-color-focus-${r});
|
|
`,[l("state-border",`
|
|
box-shadow: var(--n-box-shadow-focus-${r});
|
|
border: var(--n-border-focus-${r});
|
|
`)]),z("focus",`
|
|
background-color: var(--n-color-focus-${r});
|
|
`,[l("state-border",`
|
|
box-shadow: var(--n-box-shadow-focus-${r});
|
|
border: var(--n-border-focus-${r});
|
|
`)])])]))]),Dr=x("input",[z("disabled",[l("input-el, textarea-el",`
|
|
-webkit-text-fill-color: var(--n-text-color-disabled);
|
|
`)])]),Lr=Object.assign(Object.assign({},Ae.props),{bordered:{type:Boolean,default:void 0},type:{type:String,default:"text"},placeholder:[Array,String],defaultValue:{type:[String,Array],default:null},value:[String,Array],disabled:{type:Boolean,default:void 0},size:String,rows:{type:[Number,String],default:3},round:Boolean,minlength:[String,Number],maxlength:[String,Number],clearable:Boolean,autosize:{type:[Boolean,Object],default:!1},pair:Boolean,separator:String,readonly:{type:[String,Boolean],default:!1},passivelyActivated:Boolean,showPasswordOn:String,stateful:{type:Boolean,default:!0},autofocus:Boolean,inputProps:Object,resizable:{type:Boolean,default:!0},showCount:Boolean,loading:{type:Boolean,default:void 0},allowInput:Function,renderCount:Function,onMousedown:Function,onKeydown:Function,onKeyup:[Function,Array],onInput:[Function,Array],onFocus:[Function,Array],onBlur:[Function,Array],onClick:[Function,Array],onChange:[Function,Array],onClear:[Function,Array],countGraphemes:Function,status:String,"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],textDecoration:[String,Array],attrSize:{type:Number,default:20},onInputBlur:[Function,Array],onInputFocus:[Function,Array],onDeactivate:[Function,Array],onActivate:[Function,Array],onWrapperFocus:[Function,Array],onWrapperBlur:[Function,Array],internalDeactivateOnEnter:Boolean,internalForceFocus:Boolean,internalLoadingBeforeSuffix:{type:Boolean,default:!0},showPasswordToggle:Boolean}),Or=k({name:"Input",props:Lr,setup(r){const{mergedClsPrefixRef:v,mergedBorderedRef:n,inlineThemeDisabled:_,mergedRtlRef:A}=fr(r),b=Ae("Input","-input",Mr,_r,r,v);vr&&_e("-input-safari",Dr,v);const h=w(null),s=w(null),u=w(null),c=w(null),i=w(null),g=w(null),m=w(null),I=Tr(m),S=w(null),{localeRef:Re}=Fr("Input"),U=w(r.defaultValue),Be=de(r,"value"),F=pr(Be,U),L=gr(r),{mergedSizeRef:re,mergedDisabledRef:T,mergedStatusRef:$e}=L,M=w(!1),V=w(!1),B=w(!1),W=w(!1);let te=null;const ne=R(()=>{const{placeholder:e,pair:o}=r;return o?Array.isArray(e)?e:e===void 0?["",""]:[e,e]:e===void 0?[Re.value.placeholder]:[e]}),Pe=R(()=>{const{value:e}=B,{value:o}=F,{value:a}=ne;return!e&&(ee(o)||Array.isArray(o)&&ee(o[0]))&&a[0]}),Ee=R(()=>{const{value:e}=B,{value:o}=F,{value:a}=ne;return!e&&a[1]&&(ee(o)||Array.isArray(o)&&ee(o[1]))}),ae=me(()=>r.internalForceFocus||M.value),ke=me(()=>{if(T.value||r.readonly||!r.clearable||!ae.value&&!V.value)return!1;const{value:e}=F,{value:o}=ae;return r.pair?!!(Array.isArray(e)&&(e[0]||e[1]))&&(V.value||o):!!e&&(V.value||o)}),le=R(()=>{const{showPasswordOn:e}=r;if(e)return e;if(r.showPasswordToggle)return"click"}),O=w(!1),Ie=R(()=>{const{textDecoration:e}=r;return e?Array.isArray(e)?e.map(o=>({textDecoration:o})):[{textDecoration:e}]:["",""]}),ve=w(void 0),Te=()=>{var e,o;if(r.type==="textarea"){const{autosize:a}=r;if(a&&(ve.value=(o=(e=S.value)===null||e===void 0?void 0:e.$el)===null||o===void 0?void 0:o.offsetWidth),!s.value||typeof a=="boolean")return;const{paddingTop:f,paddingBottom:p,lineHeight:d}=window.getComputedStyle(s.value),$=Number(f.slice(0,-2)),P=Number(p.slice(0,-2)),E=Number(d.slice(0,-2)),{value:N}=u;if(!N)return;if(a.minRows){const H=Math.max(a.minRows,1),ce=`${$+P+E*H}px`;N.style.minHeight=ce}if(a.maxRows){const H=`${$+P+E*a.maxRows}px`;N.style.maxHeight=H}}},Me=R(()=>{const{maxlength:e}=r;return e===void 0?void 0:Number(e)});br(()=>{const{value:e}=F;Array.isArray(e)||se(e)});const De=xr().proxy;function G(e,o){const{onUpdateValue:a,"onUpdate:value":f,onInput:p}=r,{nTriggerFormInput:d}=L;a&&y(a,e,o),f&&y(f,e,o),p&&y(p,e,o),U.value=e,d()}function Y(e,o){const{onChange:a}=r,{nTriggerFormChange:f}=L;a&&y(a,e,o),U.value=e,f()}function Le(e){const{onBlur:o}=r,{nTriggerFormBlur:a}=L;o&&y(o,e),a()}function Ve(e){const{onFocus:o}=r,{nTriggerFormFocus:a}=L;o&&y(o,e),a()}function We(e){const{onClear:o}=r;o&&y(o,e)}function Oe(e){const{onInputBlur:o}=r;o&&y(o,e)}function Ne(e){const{onInputFocus:o}=r;o&&y(o,e)}function He(){const{onDeactivate:e}=r;e&&y(e)}function Ke(){const{onActivate:e}=r;e&&y(e)}function je(e){const{onClick:o}=r;o&&y(o,e)}function Ue(e){const{onWrapperFocus:o}=r;o&&y(o,e)}function Ge(e){const{onWrapperBlur:o}=r;o&&y(o,e)}function Ye(){B.value=!0}function Xe(e){B.value=!1,e.target===g.value?X(e,1):X(e,0)}function X(e,o=0,a="input"){const f=e.target.value;if(se(f),e instanceof InputEvent&&!e.isComposing&&(B.value=!1),r.type==="textarea"){const{value:d}=S;d&&d.syncUnifiedContainer()}if(te=f,B.value)return;I.recordCursor();const p=qe(f);if(p)if(!r.pair)a==="input"?G(f,{source:o}):Y(f,{source:o});else{let{value:d}=F;Array.isArray(d)?d=[d[0],d[1]]:d=["",""],d[o]=f,a==="input"?G(d,{source:o}):Y(d,{source:o})}De.$forceUpdate(),p||ye(I.restoreCursor)}function qe(e){const{countGraphemes:o,maxlength:a,minlength:f}=r;if(o){let d;if(a!==void 0&&(d===void 0&&(d=o(e)),d>Number(a))||f!==void 0&&(d===void 0&&(d=o(e)),d<Number(a)))return!1}const{allowInput:p}=r;return typeof p=="function"?p(e):!0}function Ze(e){Oe(e),e.relatedTarget===h.value&&He(),e.relatedTarget!==null&&(e.relatedTarget===i.value||e.relatedTarget===g.value||e.relatedTarget===s.value)||(W.value=!1),q(e,"blur"),m.value=null}function Je(e,o){Ne(e),M.value=!0,W.value=!0,Ke(),q(e,"focus"),o===0?m.value=i.value:o===1?m.value=g.value:o===2&&(m.value=s.value)}function Qe(e){r.passivelyActivated&&(Ge(e),q(e,"blur"))}function eo(e){r.passivelyActivated&&(M.value=!0,Ue(e),q(e,"focus"))}function q(e,o){e.relatedTarget!==null&&(e.relatedTarget===i.value||e.relatedTarget===g.value||e.relatedTarget===s.value||e.relatedTarget===h.value)||(o==="focus"?(Ve(e),M.value=!0):o==="blur"&&(Le(e),M.value=!1))}function oo(e,o){X(e,o,"change")}function ro(e){je(e)}function to(e){We(e),pe()}function pe(){r.pair?(G(["",""],{source:"clear"}),Y(["",""],{source:"clear"})):(G("",{source:"clear"}),Y("",{source:"clear"}))}function no(e){const{onMousedown:o}=r;o&&o(e);const{tagName:a}=e.target;if(a!=="INPUT"&&a!=="TEXTAREA"){if(r.resizable){const{value:f}=h;if(f){const{left:p,top:d,width:$,height:P}=f.getBoundingClientRect(),E=14;if(p+$-E<e.clientX&&e.clientX<p+$&&d+P-E<e.clientY&&e.clientY<d+P)return}}e.preventDefault(),M.value||ge()}}function ao(){var e;V.value=!0,r.type==="textarea"&&((e=S.value)===null||e===void 0||e.handleMouseEnterWrapper())}function lo(){var e;V.value=!1,r.type==="textarea"&&((e=S.value)===null||e===void 0||e.handleMouseLeaveWrapper())}function io(){T.value||le.value==="click"&&(O.value=!O.value)}function so(e){if(T.value)return;e.preventDefault();const o=f=>{f.preventDefault(),ze("mouseup",document,o)};if(Ce("mouseup",document,o),le.value!=="mousedown")return;O.value=!0;const a=()=>{O.value=!1,ze("mouseup",document,a)};Ce("mouseup",document,a)}function co(e){r.onKeyup&&y(r.onKeyup,e)}function uo(e){switch(r.onKeydown&&y(r.onKeydown,e),e.key){case"Escape":ie();break;case"Enter":ho(e);break}}function ho(e){var o,a;if(r.passivelyActivated){const{value:f}=W;if(f){r.internalDeactivateOnEnter&&ie();return}e.preventDefault(),r.type==="textarea"?(o=s.value)===null||o===void 0||o.focus():(a=i.value)===null||a===void 0||a.focus()}}function ie(){r.passivelyActivated&&(W.value=!1,ye(()=>{var e;(e=h.value)===null||e===void 0||e.focus()}))}function ge(){var e,o,a;T.value||(r.passivelyActivated?(e=h.value)===null||e===void 0||e.focus():((o=s.value)===null||o===void 0||o.focus(),(a=i.value)===null||a===void 0||a.focus()))}function fo(){var e;!((e=h.value)===null||e===void 0)&&e.contains(document.activeElement)&&document.activeElement.blur()}function vo(){var e,o;(e=s.value)===null||e===void 0||e.select(),(o=i.value)===null||o===void 0||o.select()}function po(){T.value||(s.value?s.value.focus():i.value&&i.value.focus())}function go(){const{value:e}=h;e!=null&&e.contains(document.activeElement)&&e!==document.activeElement&&ie()}function bo(e){if(r.type==="textarea"){const{value:o}=s;o==null||o.scrollTo(e)}else{const{value:o}=i;o==null||o.scrollTo(e)}}function se(e){const{type:o,pair:a,autosize:f}=r;if(!a&&f)if(o==="textarea"){const{value:p}=u;p&&(p.textContent=`${e??""}\r
|
|
`)}else{const{value:p}=c;p&&(e?p.textContent=e:p.innerHTML=" ")}}function xo(){Te()}const be=w({top:"0"});function mo(e){var o;const{scrollTop:a}=e.target;be.value.top=`${-a}px`,(o=S.value)===null||o===void 0||o.syncUnifiedContainer()}let Z=null;we(()=>{const{autosize:e,type:o}=r;e&&o==="textarea"?Z=he(F,a=>{!Array.isArray(a)&&a!==te&&se(a)}):Z==null||Z()});let J=null;we(()=>{r.type==="textarea"?J=he(F,e=>{var o;!Array.isArray(e)&&e!==te&&((o=S.value)===null||o===void 0||o.syncUnifiedContainer())}):J==null||J()}),mr(Fe,{mergedValueRef:F,maxlengthRef:Me,mergedClsPrefixRef:v,countGraphemesRef:de(r,"countGraphemes")});const wo={wrapperElRef:h,inputElRef:i,textareaElRef:s,isCompositing:B,clear:pe,focus:ge,blur:fo,select:vo,deactivate:go,activate:po,scrollTo:bo},yo=wr("Input",A,v),xe=R(()=>{const{value:e}=re,{common:{cubicBezierEaseInOut:o},self:{color:a,borderRadius:f,textColor:p,caretColor:d,caretColorError:$,caretColorWarning:P,textDecorationColor:E,border:N,borderDisabled:H,borderHover:ce,borderFocus:Co,placeholderColor:zo,placeholderColorDisabled:So,lineHeightTextarea:_o,colorDisabled:Ao,colorFocus:Fo,textColorDisabled:Ro,boxShadowFocus:Bo,iconSize:$o,colorFocusWarning:Po,boxShadowFocusWarning:Eo,borderWarning:ko,borderFocusWarning:Io,borderHoverWarning:To,colorFocusError:Mo,boxShadowFocusError:Do,borderError:Lo,borderFocusError:Vo,borderHoverError:Wo,clearSize:Oo,clearColor:No,clearColorHover:Ho,clearColorPressed:Ko,iconColor:jo,iconColorDisabled:Uo,suffixTextColor:Go,countTextColor:Yo,countTextColorDisabled:Xo,iconColorHover:qo,iconColorPressed:Zo,loadingColor:Jo,loadingColorError:Qo,loadingColorWarning:er,[ue("padding",e)]:or,[ue("fontSize",e)]:rr,[ue("height",e)]:tr}}=b.value,{left:nr,right:ar}=Ar(or);return{"--n-bezier":o,"--n-count-text-color":Yo,"--n-count-text-color-disabled":Xo,"--n-color":a,"--n-font-size":rr,"--n-border-radius":f,"--n-height":tr,"--n-padding-left":nr,"--n-padding-right":ar,"--n-text-color":p,"--n-caret-color":d,"--n-text-decoration-color":E,"--n-border":N,"--n-border-disabled":H,"--n-border-hover":ce,"--n-border-focus":Co,"--n-placeholder-color":zo,"--n-placeholder-color-disabled":So,"--n-icon-size":$o,"--n-line-height-textarea":_o,"--n-color-disabled":Ao,"--n-color-focus":Fo,"--n-text-color-disabled":Ro,"--n-box-shadow-focus":Bo,"--n-loading-color":Jo,"--n-caret-color-warning":P,"--n-color-focus-warning":Po,"--n-box-shadow-focus-warning":Eo,"--n-border-warning":ko,"--n-border-focus-warning":Io,"--n-border-hover-warning":To,"--n-loading-color-warning":er,"--n-caret-color-error":$,"--n-color-focus-error":Mo,"--n-box-shadow-focus-error":Do,"--n-border-error":Lo,"--n-border-focus-error":Vo,"--n-border-hover-error":Wo,"--n-loading-color-error":Qo,"--n-clear-color":No,"--n-clear-size":Oo,"--n-clear-color-hover":Ho,"--n-clear-color-pressed":Ko,"--n-icon-color":jo,"--n-icon-color-hover":qo,"--n-icon-color-pressed":Zo,"--n-icon-color-disabled":Uo,"--n-suffix-text-color":Go}}),D=_?yr("input",R(()=>{const{value:e}=re;return e[0]}),xe,r):void 0;return Object.assign(Object.assign({},wo),{wrapperElRef:h,inputElRef:i,inputMirrorElRef:c,inputEl2Ref:g,textareaElRef:s,textareaMirrorElRef:u,textareaScrollbarInstRef:S,rtlEnabled:yo,uncontrolledValue:U,mergedValue:F,passwordVisible:O,mergedPlaceholder:ne,showPlaceholder1:Pe,showPlaceholder2:Ee,mergedFocus:ae,isComposing:B,activated:W,showClearButton:ke,mergedSize:re,mergedDisabled:T,textDecorationStyle:Ie,mergedClsPrefix:v,mergedBordered:n,mergedShowPasswordOn:le,placeholderStyle:be,mergedStatus:$e,textAreaScrollContainerWidth:ve,handleTextAreaScroll:mo,handleCompositionStart:Ye,handleCompositionEnd:Xe,handleInput:X,handleInputBlur:Ze,handleInputFocus:Je,handleWrapperBlur:Qe,handleWrapperFocus:eo,handleMouseEnter:ao,handleMouseLeave:lo,handleMouseDown:no,handleChange:oo,handleClick:ro,handleClear:to,handlePasswordToggleClick:io,handlePasswordToggleMousedown:so,handleWrapperKeydown:uo,handleWrapperKeyup:co,handleTextAreaMirrorResize:xo,getTextareaScrollContainer:()=>s.value,mergedTheme:b,cssVars:_?void 0:xe,themeClass:D==null?void 0:D.themeClass,onRender:D==null?void 0:D.onRender})},render(){var r,v;const{mergedClsPrefix:n,mergedStatus:_,themeClass:A,type:b,countGraphemes:h,onRender:s}=this,u=this.$slots;return s==null||s(),t("div",{ref:"wrapperElRef",class:[`${n}-input`,A,_&&`${n}-input--${_}-status`,{[`${n}-input--rtl`]:this.rtlEnabled,[`${n}-input--disabled`]:this.mergedDisabled,[`${n}-input--textarea`]:b==="textarea",[`${n}-input--resizable`]:this.resizable&&!this.autosize,[`${n}-input--autosize`]:this.autosize,[`${n}-input--round`]:this.round&&b!=="textarea",[`${n}-input--pair`]:this.pair,[`${n}-input--focus`]:this.mergedFocus,[`${n}-input--stateful`]:this.stateful}],style:this.cssVars,tabindex:!this.mergedDisabled&&this.passivelyActivated&&!this.activated?0:void 0,onFocus:this.handleWrapperFocus,onBlur:this.handleWrapperBlur,onClick:this.handleClick,onMousedown:this.handleMouseDown,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,onCompositionstart:this.handleCompositionStart,onCompositionend:this.handleCompositionEnd,onKeyup:this.handleWrapperKeyup,onKeydown:this.handleWrapperKeydown},t("div",{class:`${n}-input-wrapper`},Q(u.prefix,c=>c&&t("div",{class:`${n}-input__prefix`},c)),b==="textarea"?t(Cr,{ref:"textareaScrollbarInstRef",class:`${n}-input__textarea`,container:this.getTextareaScrollContainer,triggerDisplayManually:!0,useUnifiedContainer:!0,internalHoistYRail:!0},{default:()=>{var c,i;const{textAreaScrollContainerWidth:g}=this,m={width:this.autosize&&g&&`${g}px`};return t(zr,null,t("textarea",Object.assign({},this.inputProps,{ref:"textareaElRef",class:[`${n}-input__textarea-el`,(c=this.inputProps)===null||c===void 0?void 0:c.class],autofocus:this.autofocus,rows:Number(this.rows),placeholder:this.placeholder,value:this.mergedValue,disabled:this.mergedDisabled,maxlength:h?void 0:this.maxlength,minlength:h?void 0:this.minlength,readonly:this.readonly,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,style:[this.textDecorationStyle[0],(i=this.inputProps)===null||i===void 0?void 0:i.style,m],onBlur:this.handleInputBlur,onFocus:I=>{this.handleInputFocus(I,2)},onInput:this.handleInput,onChange:this.handleChange,onScroll:this.handleTextAreaScroll})),this.showPlaceholder1?t("div",{class:`${n}-input__placeholder`,style:[this.placeholderStyle,m],key:"placeholder"},this.mergedPlaceholder[0]):null,this.autosize?t(Sr,{onResize:this.handleTextAreaMirrorResize},{default:()=>t("div",{ref:"textareaMirrorElRef",class:`${n}-input__textarea-mirror`,key:"mirror"})}):null)}}):t("div",{class:`${n}-input__input`},t("input",Object.assign({type:b==="password"&&this.mergedShowPasswordOn&&this.passwordVisible?"text":b},this.inputProps,{ref:"inputElRef",class:[`${n}-input__input-el`,(r=this.inputProps)===null||r===void 0?void 0:r.class],style:[this.textDecorationStyle[0],(v=this.inputProps)===null||v===void 0?void 0:v.style],tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[0],disabled:this.mergedDisabled,maxlength:h?void 0:this.maxlength,minlength:h?void 0:this.minlength,value:Array.isArray(this.mergedValue)?this.mergedValue[0]:this.mergedValue,readonly:this.readonly,autofocus:this.autofocus,size:this.attrSize,onBlur:this.handleInputBlur,onFocus:c=>{this.handleInputFocus(c,0)},onInput:c=>{this.handleInput(c,0)},onChange:c=>{this.handleChange(c,0)}})),this.showPlaceholder1?t("div",{class:`${n}-input__placeholder`},t("span",null,this.mergedPlaceholder[0])):null,this.autosize?t("div",{class:`${n}-input__input-mirror`,key:"mirror",ref:"inputMirrorElRef"}," "):null),!this.pair&&Q(u.suffix,c=>c||this.clearable||this.showCount||this.mergedShowPasswordOn||this.loading!==void 0?t("div",{class:`${n}-input__suffix`},[Q(u["clear-icon-placeholder"],i=>(this.clearable||i)&&t(fe,{clsPrefix:n,show:this.showClearButton,onClear:this.handleClear},{placeholder:()=>i,icon:()=>{var g,m;return(m=(g=this.$slots)["clear-icon"])===null||m===void 0?void 0:m.call(g)}})),this.internalLoadingBeforeSuffix?null:c,this.loading!==void 0?t(kr,{clsPrefix:n,loading:this.loading,showArrow:!1,showClear:!1,style:this.cssVars}):null,this.internalLoadingBeforeSuffix?c:null,this.showCount&&this.type!=="textarea"?t(Se,null,{default:i=>{var g;return(g=u.count)===null||g===void 0?void 0:g.call(u,i)}}):null,this.mergedShowPasswordOn&&this.type==="password"?t("div",{class:`${n}-input__eye`,onMousedown:this.handlePasswordToggleMousedown,onClick:this.handlePasswordToggleClick},this.passwordVisible?j(u["password-visible-icon"],()=>[t(oe,{clsPrefix:n},{default:()=>t(Rr,null)})]):j(u["password-invisible-icon"],()=>[t(oe,{clsPrefix:n},{default:()=>t(Br,null)})])):null]):null)),this.pair?t("span",{class:`${n}-input__separator`},j(u.separator,()=>[this.separator])):null,this.pair?t("div",{class:`${n}-input-wrapper`},t("div",{class:`${n}-input__input`},t("input",{ref:"inputEl2Ref",type:this.type,class:`${n}-input__input-el`,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[1],disabled:this.mergedDisabled,maxlength:h?void 0:this.maxlength,minlength:h?void 0:this.minlength,value:Array.isArray(this.mergedValue)?this.mergedValue[1]:void 0,readonly:this.readonly,style:this.textDecorationStyle[1],onBlur:this.handleInputBlur,onFocus:c=>{this.handleInputFocus(c,1)},onInput:c=>{this.handleInput(c,1)},onChange:c=>{this.handleChange(c,1)}}),this.showPlaceholder2?t("div",{class:`${n}-input__placeholder`},t("span",null,this.mergedPlaceholder[1])):null),Q(u.suffix,c=>(this.clearable||c)&&t("div",{class:`${n}-input__suffix`},[this.clearable&&t(fe,{clsPrefix:n,show:this.showClearButton,onClear:this.handleClear},{icon:()=>{var i;return(i=u["clear-icon"])===null||i===void 0?void 0:i.call(u)},placeholder:()=>{var i;return(i=u["clear-icon-placeholder"])===null||i===void 0?void 0:i.call(u)}}),c]))):null,this.mergedBordered?t("div",{class:`${n}-input__border`}):null,this.mergedBordered?t("div",{class:`${n}-input__state-border`}):null,this.showCount&&b==="textarea"?t(Se,null,{default:c=>{var i;const{renderCount:g}=this;return g?g(c):(i=u.count)===null||i===void 0?void 0:i.call(u,c)}}):null)}});export{$r as C,Rr as E,kr as N,Or as _};
|