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