generated from VLADIMIR/template_frontend
234 lines
28 KiB
JavaScript
234 lines
28 KiB
JavaScript
import{$ as e,A as t,H as n,K as r,L as i,M as a,P as o,b as s,et as c,ft as l,h as u,ht as d,k as f}from"./client-BBfBDiVG.js";import{G as p,J as m,K as h,M as ee,N as te,X as g,Y as _,Z as v,i as ne,o as re,r as ie,z as y}from"./light-DqAV2QCd.js";import{c as b,d as x,i as S,u as C}from"./Card-Cze8lALH.js";import{r as ae}from"./css-DEmdllcC.js";import{t as oe}from"./use-merged-state-DRpgLPWV.js";import{i as se}from"./Button-DAM1cqtA.js";import{n as ce,r as w}from"./use-form-item-ajbhslgm.js";import{a as T,i as E,r as D}from"./resolve-slot-C_Onglzh.js";import{n as O,r as le,t as k}from"./Suffix-DM_ippuo.js";import{U as A,X as j,w as ue}from"./index-DnUl8nHF.js";var M=f({name:`Eye`,render(){return a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`},a(`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`}),a(`circle`,{cx:`256`,cy:`256`,r:`80`,fill:`none`,stroke:`currentColor`,"stroke-miterlimit":`10`,"stroke-width":`32`}))}}),N=f({name:`EyeOff`,render(){return a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 512 512`},a(`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`}),a(`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`}),a(`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`}),a(`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`}),a(`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`}))}}),P=y(`n-input`),de=h(`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);
|
|
font-weight: var(--n-font-weight);
|
|
--n-padding-vertical: calc((var(--n-height) - 1.5 * var(--n-font-size)) / 2);
|
|
`,[m(`input, textarea`,`
|
|
overflow: hidden;
|
|
flex-grow: 1;
|
|
position: relative;
|
|
`),m(`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);
|
|
`),m(`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;
|
|
`,[p(`&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb`,`
|
|
width: 0;
|
|
height: 0;
|
|
display: none;
|
|
`),p(`&::placeholder`,`
|
|
color: #0000;
|
|
-webkit-text-fill-color: transparent !important;
|
|
`),p(`&:-webkit-autofill ~`,[m(`placeholder`,`display: none;`)])]),_(`round`,[g(`textarea`,`border-radius: calc(var(--n-height) / 2);`)]),m(`placeholder`,`
|
|
pointer-events: none;
|
|
position: absolute;
|
|
left: 0;
|
|
right: 0;
|
|
top: 0;
|
|
bottom: 0;
|
|
overflow: hidden;
|
|
color: var(--n-placeholder-color);
|
|
`,[p(`span`,`
|
|
width: 100%;
|
|
display: inline-block;
|
|
`)]),_(`textarea`,[m(`placeholder`,`overflow: visible;`)]),g(`autosize`,`width: 100%;`),_(`autosize`,[m(`textarea-el, input-el`,`
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
height: 100%;
|
|
`)]),h(`input-wrapper`,`
|
|
overflow: hidden;
|
|
display: inline-flex;
|
|
flex-grow: 1;
|
|
position: relative;
|
|
padding-left: var(--n-padding-left);
|
|
padding-right: var(--n-padding-right);
|
|
`),m(`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;
|
|
`),m(`input-el`,`
|
|
padding: 0;
|
|
height: var(--n-height);
|
|
line-height: var(--n-height);
|
|
`,[p(`&[type=password]::-ms-reveal`,`display: none;`),p(`+`,[m(`placeholder`,`
|
|
display: flex;
|
|
align-items: center;
|
|
`)])]),g(`textarea`,[m(`placeholder`,`white-space: nowrap;`)]),m(`eye`,`
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: color .3s var(--n-bezier);
|
|
`),_(`textarea`,`width: 100%;`,[h(`input-word-count`,`
|
|
position: absolute;
|
|
right: var(--n-padding-right);
|
|
bottom: var(--n-padding-vertical);
|
|
`),_(`resizable`,[h(`input-wrapper`,`
|
|
resize: vertical;
|
|
min-height: var(--n-height);
|
|
`)]),m(`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);
|
|
`),m(`textarea-mirror`,`
|
|
width: 100%;
|
|
pointer-events: none;
|
|
overflow: hidden;
|
|
visibility: hidden;
|
|
position: static;
|
|
white-space: pre-wrap;
|
|
overflow-wrap: break-word;
|
|
`)]),_(`pair`,[m(`input-el, placeholder`,`text-align: center;`),m(`separator`,`
|
|
display: flex;
|
|
align-items: center;
|
|
transition: color .3s var(--n-bezier);
|
|
color: var(--n-text-color);
|
|
white-space: nowrap;
|
|
`,[h(`icon`,`
|
|
color: var(--n-icon-color);
|
|
`),h(`base-icon`,`
|
|
color: var(--n-icon-color);
|
|
`)])]),_(`disabled`,`
|
|
cursor: not-allowed;
|
|
background-color: var(--n-color-disabled);
|
|
`,[m(`border`,`border: var(--n-border-disabled);`),m(`input-el, textarea-el`,`
|
|
cursor: not-allowed;
|
|
color: var(--n-text-color-disabled);
|
|
text-decoration-color: var(--n-text-color-disabled);
|
|
`),m(`placeholder`,`color: var(--n-placeholder-color-disabled);`),m(`separator`,`color: var(--n-text-color-disabled);`,[h(`icon`,`
|
|
color: var(--n-icon-color-disabled);
|
|
`),h(`base-icon`,`
|
|
color: var(--n-icon-color-disabled);
|
|
`)]),h(`input-word-count`,`
|
|
color: var(--n-count-text-color-disabled);
|
|
`),m(`suffix, prefix`,`color: var(--n-text-color-disabled);`,[h(`icon`,`
|
|
color: var(--n-icon-color-disabled);
|
|
`),h(`internal-icon`,`
|
|
color: var(--n-icon-color-disabled);
|
|
`)])]),g(`disabled`,[m(`eye`,`
|
|
color: var(--n-icon-color);
|
|
cursor: pointer;
|
|
`,[p(`&:hover`,`
|
|
color: var(--n-icon-color-hover);
|
|
`),p(`&:active`,`
|
|
color: var(--n-icon-color-pressed);
|
|
`)]),p(`&:hover`,[m(`state-border`,`border: var(--n-border-hover);`)]),_(`focus`,`background-color: var(--n-color-focus);`,[m(`state-border`,`
|
|
border: var(--n-border-focus);
|
|
box-shadow: var(--n-box-shadow-focus);
|
|
`)])]),m(`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);
|
|
`),m(`state-border`,`
|
|
border-color: #0000;
|
|
z-index: 1;
|
|
`),m(`prefix`,`margin-right: 4px;`),m(`suffix`,`
|
|
margin-left: 4px;
|
|
`),m(`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);
|
|
`,[h(`base-loading`,`
|
|
font-size: var(--n-icon-size);
|
|
margin: 0 2px;
|
|
color: var(--n-loading-color);
|
|
`),h(`base-clear`,`
|
|
font-size: var(--n-icon-size);
|
|
`,[m(`placeholder`,[h(`base-icon`,`
|
|
transition: color .3s var(--n-bezier);
|
|
color: var(--n-icon-color);
|
|
font-size: var(--n-icon-size);
|
|
`)])]),p(`>`,[h(`icon`,`
|
|
transition: color .3s var(--n-bezier);
|
|
color: var(--n-icon-color);
|
|
font-size: var(--n-icon-size);
|
|
`)]),h(`base-icon`,`
|
|
font-size: var(--n-icon-size);
|
|
`)]),h(`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(e=>_(`${e}-status`,[g(`disabled`,[h(`base-loading`,`
|
|
color: var(--n-loading-color-${e})
|
|
`),m(`input-el, textarea-el`,`
|
|
caret-color: var(--n-caret-color-${e});
|
|
`),m(`state-border`,`
|
|
border: var(--n-border-${e});
|
|
`),p(`&:hover`,[m(`state-border`,`
|
|
border: var(--n-border-hover-${e});
|
|
`)]),p(`&:focus`,`
|
|
background-color: var(--n-color-focus-${e});
|
|
`,[m(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-focus-${e});
|
|
border: var(--n-border-focus-${e});
|
|
`)]),_(`focus`,`
|
|
background-color: var(--n-color-focus-${e});
|
|
`,[m(`state-border`,`
|
|
box-shadow: var(--n-box-shadow-focus-${e});
|
|
border: var(--n-border-focus-${e});
|
|
`)])])]))]),fe=h(`input`,[_(`disabled`,[m(`input-el, textarea-el`,`
|
|
-webkit-text-fill-color: var(--n-text-color-disabled);
|
|
`)])]);function F(e){let t=0;for(let n of e)t++;return t}function I(e){return e===``||e==null}function pe(t){let n=l(null);function r(){let{value:e}=t;if(!e?.focus){a();return}let{selectionStart:r,selectionEnd:i,value:o}=e;if(r==null||i==null){a();return}n.value={start:r,end:i,beforeText:o.slice(0,r),afterText:o.slice(i)}}function i(){var e;let{value:r}=n,{value:i}=t;if(!r||!i)return;let{value:a}=i,{start:o,beforeText:s,afterText:c}=r,l=a.length;if(a.endsWith(c))l=a.length-c.length;else if(a.startsWith(s))l=s.length;else{let e=s[o-1],t=a.indexOf(e,o-1);t!==-1&&(l=t+1)}(e=i.setSelectionRange)==null||e.call(i,l,l)}function a(){n.value=null}return e(t,a),{recordCursor:r,restoreCursor:i}}var L=f({name:`InputWordCount`,setup(e,{slots:t}){let{mergedValueRef:n,maxlengthRef:r,mergedClsPrefixRef:i,countGraphemesRef:c}=o(P),l=s(()=>{let{value:e}=n;return e===null||Array.isArray(e)?0:(c.value||F)(e)});return()=>{let{value:e}=r,{value:o}=n;return a(`span`,{class:`${i.value}-input-word-count`},E(t.default,{value:o===null||Array.isArray(o)?``:o},()=>[e===void 0?l.value:`${l.value} / ${e}`]))}}}),R=f({name:`Input`,props:Object.assign(Object.assign({},ie.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}),slots:Object,setup(a){let{mergedClsPrefixRef:o,mergedBorderedRef:u,inlineThemeDisabled:f,mergedRtlRef:p,mergedComponentPropsRef:m}=te(a),h=ie(`Input`,`-input`,de,ue,a,o);se&&ne(`-input-safari`,fe,o);let g=l(null),_=l(null),y=l(null),b=l(null),S=l(null),T=l(null),E=l(null),D=pe(E),O=l(null),{localeRef:k}=le(`Input`),A=l(a.defaultValue),M=oe(d(a,`value`),A),N=ce(a,{mergedSize:e=>{let{size:t}=a;if(t)return t;let{mergedSize:n}=e||{};return n?.value?n.value:m?.value?.Input?.size||`medium`}}),{mergedSizeRef:F,mergedDisabledRef:L,mergedStatusRef:R}=N,z=l(!1),B=l(!1),V=l(!1),H=l(!1),U=null,W=s(()=>{let{placeholder:e,pair:t}=a;return t?Array.isArray(e)?e:e===void 0?[``,``]:[e,e]:e===void 0?[k.value.placeholder]:[e]}),me=s(()=>{let{value:e}=V,{value:t}=M,{value:n}=W;return!e&&(I(t)||Array.isArray(t)&&I(t[0]))&&n[0]}),he=s(()=>{let{value:e}=V,{value:t}=M,{value:n}=W;return!e&&n[1]&&(I(t)||Array.isArray(t)&&I(t[1]))}),G=j(()=>a.internalForceFocus||z.value),ge=j(()=>{if(L.value||a.readonly||!a.clearable||!G.value&&!B.value)return!1;let{value:e}=M,{value:t}=G;return a.pair?!!(Array.isArray(e)&&(e[0]||e[1]))&&(B.value||t):!!e&&(B.value||t)}),K=s(()=>{let{showPasswordOn:e}=a;if(e)return e;if(a.showPasswordToggle)return`click`}),q=l(!1),_e=s(()=>{let{textDecoration:e}=a;return e?Array.isArray(e)?e.map(e=>({textDecoration:e})):[{textDecoration:e}]:[``,``]}),ve=l(void 0),ye=()=>{if(a.type===`textarea`){let{autosize:e}=a;if(e&&(ve.value=O.value?.$el?.offsetWidth),!_.value||typeof e==`boolean`)return;let{paddingTop:t,paddingBottom:n,lineHeight:r}=window.getComputedStyle(_.value),i=Number(t.slice(0,-2)),o=Number(n.slice(0,-2)),s=Number(r.slice(0,-2)),{value:c}=y;if(!c)return;if(e.minRows){let t=Math.max(e.minRows,1),n=`${i+o+s*t}px`;c.style.minHeight=n}if(e.maxRows){let t=`${i+o+s*e.maxRows}px`;c.style.maxHeight=t}}},be=s(()=>{let{maxlength:e}=a;return e===void 0?void 0:Number(e)});n(()=>{let{value:e}=M;Array.isArray(e)||$(e)});let xe=t().proxy;function J(e,t){let{onUpdateValue:n,"onUpdate:value":r,onInput:i}=a,{nTriggerFormInput:o}=N;n&&w(n,e,t),r&&w(r,e,t),i&&w(i,e,t),A.value=e,o()}function Y(e,t){let{onChange:n}=a,{nTriggerFormChange:r}=N;n&&w(n,e,t),A.value=e,r()}function Se(e){let{onBlur:t}=a,{nTriggerFormBlur:n}=N;t&&w(t,e),n()}function Ce(e){let{onFocus:t}=a,{nTriggerFormFocus:n}=N;t&&w(t,e),n()}function we(e){let{onClear:t}=a;t&&w(t,e)}function Te(e){let{onInputBlur:t}=a;t&&w(t,e)}function Ee(e){let{onInputFocus:t}=a;t&&w(t,e)}function De(){let{onDeactivate:e}=a;e&&w(e)}function Oe(){let{onActivate:e}=a;e&&w(e)}function ke(e){let{onClick:t}=a;t&&w(t,e)}function Ae(e){let{onWrapperFocus:t}=a;t&&w(t,e)}function je(e){let{onWrapperBlur:t}=a;t&&w(t,e)}function Me(){V.value=!0}function Ne(e){V.value=!1,e.target===T.value?X(e,1):X(e,0)}function X(e,t=0,n=`input`){let r=e.target.value;if($(r),e instanceof InputEvent&&!e.isComposing&&(V.value=!1),a.type===`textarea`){let{value:e}=O;e&&e.syncUnifiedContainer()}if(U=r,V.value)return;D.recordCursor();let o=Pe(r);if(o)if(!a.pair)n===`input`?J(r,{source:t}):Y(r,{source:t});else{let{value:e}=M;e=Array.isArray(e)?[e[0],e[1]]:[``,``],e[t]=r,n===`input`?J(e,{source:t}):Y(e,{source:t})}xe.$forceUpdate(),o||i(D.restoreCursor)}function Pe(e){let{countGraphemes:t,maxlength:n,minlength:r}=a;if(t){let i;if(n!==void 0&&(i===void 0&&(i=t(e)),i>Number(n))||r!==void 0&&(i===void 0&&(i=t(e)),i<Number(n)))return!1}let{allowInput:i}=a;return typeof i==`function`?i(e):!0}function Fe(e){Te(e),e.relatedTarget===g.value&&De(),e.relatedTarget!==null&&(e.relatedTarget===S.value||e.relatedTarget===T.value||e.relatedTarget===_.value)||(H.value=!1),Z(e,`blur`),E.value=null}function Ie(e,t){Ee(e),z.value=!0,H.value=!0,Oe(),Z(e,`focus`),t===0?E.value=S.value:t===1?E.value=T.value:t===2&&(E.value=_.value)}function Le(e){a.passivelyActivated&&(je(e),Z(e,`blur`))}function Re(e){a.passivelyActivated&&(z.value=!0,Ae(e),Z(e,`focus`))}function Z(e,t){e.relatedTarget!==null&&(e.relatedTarget===S.value||e.relatedTarget===T.value||e.relatedTarget===_.value||e.relatedTarget===g.value)||(t===`focus`?(Ce(e),z.value=!0):t===`blur`&&(Se(e),z.value=!1))}function ze(e,t){X(e,t,`change`)}function Be(e){ke(e)}function Ve(e){we(e),He()}function He(){a.pair?(J([``,``],{source:`clear`}),Y([``,``],{source:`clear`})):(J(``,{source:`clear`}),Y(``,{source:`clear`}))}function Ue(e){let{onMousedown:t}=a;t&&t(e);let{tagName:n}=e.target;if(n!==`INPUT`&&n!==`TEXTAREA`){if(a.resizable){let{value:t}=g;if(t){let{left:n,top:r,width:i,height:a}=t.getBoundingClientRect();if(n+i-14<e.clientX&&e.clientX<n+i&&r+a-14<e.clientY&&e.clientY<r+a)return}}e.preventDefault(),z.value||Ze()}}function We(){var e;B.value=!0,a.type===`textarea`&&((e=O.value)==null||e.handleMouseEnterWrapper())}function Ge(){var e;B.value=!1,a.type===`textarea`&&((e=O.value)==null||e.handleMouseLeaveWrapper())}function Ke(){L.value||K.value===`click`&&(q.value=!q.value)}function qe(e){if(L.value)return;e.preventDefault();let t=e=>{e.preventDefault(),C(`mouseup`,document,t)};if(x(`mouseup`,document,t),K.value!==`mousedown`)return;q.value=!0;let n=()=>{q.value=!1,C(`mouseup`,document,n)};x(`mouseup`,document,n)}function Je(e){a.onKeyup&&w(a.onKeyup,e)}function Ye(e){switch(a.onKeydown&&w(a.onKeydown,e),e.key){case`Escape`:Q();break;case`Enter`:Xe(e);break}}function Xe(e){var t,n;if(a.passivelyActivated){let{value:r}=H;if(r){a.internalDeactivateOnEnter&&Q();return}e.preventDefault(),a.type===`textarea`?(t=_.value)==null||t.focus():(n=S.value)==null||n.focus()}}function Q(){a.passivelyActivated&&(H.value=!1,i(()=>{var e;(e=g.value)==null||e.focus()}))}function Ze(){var e,t,n;L.value||(a.passivelyActivated?(e=g.value)==null||e.focus():((t=_.value)==null||t.focus(),(n=S.value)==null||n.focus()))}function Qe(){g.value?.contains(document.activeElement)&&document.activeElement.blur()}function $e(){var e,t;(e=_.value)==null||e.select(),(t=S.value)==null||t.select()}function et(){L.value||(_.value?_.value.focus():S.value&&S.value.focus())}function tt(){let{value:e}=g;e?.contains(document.activeElement)&&e!==document.activeElement&&Q()}function nt(e){if(a.type===`textarea`){let{value:t}=_;t?.scrollTo(e)}else{let{value:t}=S;t?.scrollTo(e)}}function $(e){let{type:t,pair:n,autosize:r}=a;if(!n&&r)if(t===`textarea`){let{value:t}=y;t&&(t.textContent=`${e??``}\r\n`)}else{let{value:t}=b;t&&(e?t.textContent=e:t.innerHTML=` `)}}function rt(){ye()}let it=l({top:`0`});function at(e){var t;let{scrollTop:n}=e.target;it.value.top=`${-n}px`,(t=O.value)==null||t.syncUnifiedContainer()}let ot=null;c(()=>{let{autosize:t,type:n}=a;t&&n===`textarea`?ot=e(M,e=>{!Array.isArray(e)&&e!==U&&$(e)}):ot?.()});let st=null;c(()=>{a.type===`textarea`?st=e(M,e=>{var t;!Array.isArray(e)&&e!==U&&((t=O.value)==null||t.syncUnifiedContainer())}):st?.()}),r(P,{mergedValueRef:M,maxlengthRef:be,mergedClsPrefixRef:o,countGraphemesRef:d(a,`countGraphemes`)});let ct={wrapperElRef:g,inputElRef:S,textareaElRef:_,isCompositing:V,clear:He,focus:Ze,blur:Qe,select:$e,deactivate:tt,activate:et,scrollTo:nt},lt=re(`Input`,p,o),ut=s(()=>{let{value:e}=F,{common:{cubicBezierEaseInOut:t},self:{color:n,borderRadius:r,textColor:i,caretColor:a,caretColorError:o,caretColorWarning:s,textDecorationColor:c,border:l,borderDisabled:u,borderHover:d,borderFocus:f,placeholderColor:p,placeholderColorDisabled:m,lineHeightTextarea:ee,colorDisabled:te,colorFocus:g,textColorDisabled:_,boxShadowFocus:ne,iconSize:re,colorFocusWarning:ie,boxShadowFocusWarning:y,borderWarning:b,borderFocusWarning:x,borderHoverWarning:S,colorFocusError:C,boxShadowFocusError:oe,borderError:se,borderFocusError:ce,borderHoverError:w,clearSize:T,clearColor:E,clearColorHover:D,clearColorPressed:O,iconColor:le,iconColorDisabled:k,suffixTextColor:A,countTextColor:j,countTextColorDisabled:ue,iconColorHover:M,iconColorPressed:N,loadingColor:P,loadingColorError:de,loadingColorWarning:fe,fontWeight:I,[v(`padding`,e)]:pe,[v(`fontSize`,e)]:L,[v(`height`,e)]:R}}=h.value,{left:z,right:B}=ae(pe);return{"--n-bezier":t,"--n-count-text-color":j,"--n-count-text-color-disabled":ue,"--n-color":n,"--n-font-size":L,"--n-font-weight":I,"--n-border-radius":r,"--n-height":R,"--n-padding-left":z,"--n-padding-right":B,"--n-text-color":i,"--n-caret-color":a,"--n-text-decoration-color":c,"--n-border":l,"--n-border-disabled":u,"--n-border-hover":d,"--n-border-focus":f,"--n-placeholder-color":p,"--n-placeholder-color-disabled":m,"--n-icon-size":re,"--n-line-height-textarea":ee,"--n-color-disabled":te,"--n-color-focus":g,"--n-text-color-disabled":_,"--n-box-shadow-focus":ne,"--n-loading-color":P,"--n-caret-color-warning":s,"--n-color-focus-warning":ie,"--n-box-shadow-focus-warning":y,"--n-border-warning":b,"--n-border-focus-warning":x,"--n-border-hover-warning":S,"--n-loading-color-warning":fe,"--n-caret-color-error":o,"--n-color-focus-error":C,"--n-box-shadow-focus-error":oe,"--n-border-error":se,"--n-border-focus-error":ce,"--n-border-hover-error":w,"--n-loading-color-error":de,"--n-clear-color":E,"--n-clear-size":T,"--n-clear-color-hover":D,"--n-clear-color-pressed":O,"--n-icon-color":le,"--n-icon-color-hover":M,"--n-icon-color-pressed":N,"--n-icon-color-disabled":k,"--n-suffix-text-color":A}}),dt=f?ee(`input`,s(()=>{let{value:e}=F;return e[0]}),ut,a):void 0;return Object.assign(Object.assign({},ct),{wrapperElRef:g,inputElRef:S,inputMirrorElRef:b,inputEl2Ref:T,textareaElRef:_,textareaMirrorElRef:y,textareaScrollbarInstRef:O,rtlEnabled:lt,uncontrolledValue:A,mergedValue:M,passwordVisible:q,mergedPlaceholder:W,showPlaceholder1:me,showPlaceholder2:he,mergedFocus:G,isComposing:V,activated:H,showClearButton:ge,mergedSize:F,mergedDisabled:L,textDecorationStyle:_e,mergedClsPrefix:o,mergedBordered:u,mergedShowPasswordOn:K,placeholderStyle:it,mergedStatus:R,textAreaScrollContainerWidth:ve,handleTextAreaScroll:at,handleCompositionStart:Me,handleCompositionEnd:Ne,handleInput:X,handleInputBlur:Fe,handleInputFocus:Ie,handleWrapperBlur:Le,handleWrapperFocus:Re,handleMouseEnter:We,handleMouseLeave:Ge,handleMouseDown:Ue,handleChange:ze,handleClick:Be,handleClear:Ve,handlePasswordToggleClick:Ke,handlePasswordToggleMousedown:qe,handleWrapperKeydown:Ye,handleWrapperKeyup:Je,handleTextAreaMirrorResize:rt,getTextareaScrollContainer:()=>_.value,mergedTheme:h,cssVars:f?void 0:ut,themeClass:dt?.themeClass,onRender:dt?.onRender})},render(){let{mergedClsPrefix:e,mergedStatus:t,themeClass:n,type:r,countGraphemes:i,onRender:o}=this,s=this.$slots;return o?.(),a(`div`,{ref:`wrapperElRef`,class:[`${e}-input`,`${e}-input--${this.mergedSize}-size`,n,t&&`${e}-input--${t}-status`,{[`${e}-input--rtl`]:this.rtlEnabled,[`${e}-input--disabled`]:this.mergedDisabled,[`${e}-input--textarea`]:r===`textarea`,[`${e}-input--resizable`]:this.resizable&&!this.autosize,[`${e}-input--autosize`]:this.autosize,[`${e}-input--round`]:this.round&&r!==`textarea`,[`${e}-input--pair`]:this.pair,[`${e}-input--focus`]:this.mergedFocus,[`${e}-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},a(`div`,{class:`${e}-input-wrapper`},T(s.prefix,t=>t&&a(`div`,{class:`${e}-input__prefix`},t)),r===`textarea`?a(S,{ref:`textareaScrollbarInstRef`,class:`${e}-input__textarea`,container:this.getTextareaScrollContainer,theme:this.theme?.peers?.Scrollbar,themeOverrides:this.themeOverrides?.peers?.Scrollbar,triggerDisplayManually:!0,useUnifiedContainer:!0,internalHoistYRail:!0},{default:()=>{let{textAreaScrollContainerWidth:t}=this,n={width:this.autosize&&t&&`${t}px`};return a(u,null,a(`textarea`,Object.assign({},this.inputProps,{ref:`textareaElRef`,class:[`${e}-input__textarea-el`,this.inputProps?.class],autofocus:this.autofocus,rows:Number(this.rows),placeholder:this.placeholder,value:this.mergedValue,disabled:this.mergedDisabled,maxlength:i?void 0:this.maxlength,minlength:i?void 0:this.minlength,readonly:this.readonly,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,style:[this.textDecorationStyle[0],this.inputProps?.style,n],onBlur:this.handleInputBlur,onFocus:e=>{this.handleInputFocus(e,2)},onInput:this.handleInput,onChange:this.handleChange,onScroll:this.handleTextAreaScroll})),this.showPlaceholder1?a(`div`,{class:`${e}-input__placeholder`,style:[this.placeholderStyle,n],key:`placeholder`},this.mergedPlaceholder[0]):null,this.autosize?a(b,{onResize:this.handleTextAreaMirrorResize},{default:()=>a(`div`,{ref:`textareaMirrorElRef`,class:`${e}-input__textarea-mirror`,key:`mirror`})}):null)}}):a(`div`,{class:`${e}-input__input`},a(`input`,Object.assign({type:r===`password`&&this.mergedShowPasswordOn&&this.passwordVisible?`text`:r},this.inputProps,{ref:`inputElRef`,class:[`${e}-input__input-el`,this.inputProps?.class],style:[this.textDecorationStyle[0],this.inputProps?.style],tabindex:this.passivelyActivated&&!this.activated?-1:this.inputProps?.tabindex,placeholder:this.mergedPlaceholder[0],disabled:this.mergedDisabled,maxlength:i?void 0:this.maxlength,minlength:i?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:e=>{this.handleInputFocus(e,0)},onInput:e=>{this.handleInput(e,0)},onChange:e=>{this.handleChange(e,0)}})),this.showPlaceholder1?a(`div`,{class:`${e}-input__placeholder`},a(`span`,null,this.mergedPlaceholder[0])):null,this.autosize?a(`div`,{class:`${e}-input__input-mirror`,key:`mirror`,ref:`inputMirrorElRef`},`\xA0`):null),!this.pair&&T(s.suffix,t=>t||this.clearable||this.showCount||this.mergedShowPasswordOn||this.loading!==void 0?a(`div`,{class:`${e}-input__suffix`},[T(s[`clear-icon-placeholder`],t=>(this.clearable||t)&&a(O,{clsPrefix:e,show:this.showClearButton,onClear:this.handleClear},{placeholder:()=>t,icon:()=>{var e;return(e=this.$slots)[`clear-icon`]?.call(e)}})),this.internalLoadingBeforeSuffix?null:t,this.loading===void 0?null:a(k,{clsPrefix:e,loading:this.loading,showArrow:!1,showClear:!1,style:this.cssVars}),this.internalLoadingBeforeSuffix?t:null,this.showCount&&this.type!==`textarea`?a(L,null,{default:e=>{let{renderCount:t}=this;return t?t(e):s.count?.call(s,e)}}):null,this.mergedShowPasswordOn&&this.type===`password`?a(`div`,{class:`${e}-input__eye`,onMousedown:this.handlePasswordToggleMousedown,onClick:this.handlePasswordToggleClick},this.passwordVisible?D(s[`password-visible-icon`],()=>[a(A,{clsPrefix:e},{default:()=>a(M,null)})]):D(s[`password-invisible-icon`],()=>[a(A,{clsPrefix:e},{default:()=>a(N,null)})])):null]):null)),this.pair?a(`span`,{class:`${e}-input__separator`},D(s.separator,()=>[this.separator])):null,this.pair?a(`div`,{class:`${e}-input-wrapper`},a(`div`,{class:`${e}-input__input`},a(`input`,{ref:`inputEl2Ref`,type:this.type,class:`${e}-input__input-el`,tabindex:this.passivelyActivated&&!this.activated?-1:void 0,placeholder:this.mergedPlaceholder[1],disabled:this.mergedDisabled,maxlength:i?void 0:this.maxlength,minlength:i?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:e=>{this.handleInputFocus(e,1)},onInput:e=>{this.handleInput(e,1)},onChange:e=>{this.handleChange(e,1)}}),this.showPlaceholder2?a(`div`,{class:`${e}-input__placeholder`},a(`span`,null,this.mergedPlaceholder[1])):null),T(s.suffix,t=>(this.clearable||t)&&a(`div`,{class:`${e}-input__suffix`},[this.clearable&&a(O,{clsPrefix:e,show:this.showClearButton,onClear:this.handleClear},{icon:()=>s[`clear-icon`]?.call(s),placeholder:()=>s[`clear-icon-placeholder`]?.call(s)}),t]))):null,this.mergedBordered?a(`div`,{class:`${e}-input__border`}):null,this.mergedBordered?a(`div`,{class:`${e}-input__state-border`}):null,this.showCount&&r===`textarea`?a(L,null,{default:e=>{let{renderCount:t}=this;return t?t(e):s.count?.call(s,e)}}):null)}});export{M as n,R as t}; |