Files
mini-yu/unpackage/dist/build/web/assets/input.BkLVqGkG.js

2 lines
10 KiB
JavaScript
Raw Permalink Normal View History

2026-02-10 08:05:03 +08:00
import{u as e,p as a,d as s,t,e as l,f as o,n as i,h as r,i as n,_ as c,r as u}from"./button.BC3KjxGU.js";import{d,o as f,c as p,w as h,l as m,n as y,r as x,e as b,m as g,F as _,t as C,u as I,b as w,a as k,i as v,I as S,z as P}from"./index-CJxdOECQ.js";import{R as V}from"./parent-map.DJ2qhm0x.js";const $={adjustPosition:{type:Boolean,default:!0},align:{type:String,default:"left",validator:e=>!e||["left","center","right"].includes(e)},allowInputOverMax:Boolean,alwaysEmbed:Boolean,autoFocus:Boolean,borderless:Boolean,clearTrigger:{type:String,default:"always",validator:e=>!e||["always","focus"].includes(e)},clearable:{type:[Boolean,Object],default:!1},confirmHold:Boolean,confirmType:{type:String,default:"done",validator:e=>!e||["send","search","next","go","done"].includes(e)},cursor:{type:Number,default:-1},cursorColor:{type:String,default:"#0052d9"},cursorSpacing:{type:Number,default:0},disabled:{type:Boolean,default:void 0},focus:Boolean,format:{type:Function},holdKeyboard:Boolean,label:{type:String},layout:{type:String,default:"horizontal",validator:e=>!e||["vertical","horizontal"].includes(e)},maxcharacter:{type:Number},maxlength:{type:Number,default:-1},placeholder:{type:String,default:void 0},placeholderClass:{type:String,default:"input-placeholder"},placeholderStyle:{type:String,default:""},prefixIcon:{type:[String,Object]},readonly:{type:Boolean,default:void 0},safePasswordCertPath:{type:String,default:""},safePasswordCustomHash:{type:String,default:""},safePasswordLength:{type:Number},safePasswordNonce:{type:String,default:""},safePasswordSalt:{type:String,default:""},safePasswordTimeStamp:{type:Number},selectionEnd:{type:Number,default:-1},selectionStart:{type:Number,default:-1},status:{type:String,default:"default",validator:e=>!e||["default","success","warning","error"].includes(e)},suffix:{type:String},suffixIcon:{type:[String,Object]},tips:{type:String},type:{type:String,default:"text",validator:e=>!e||["text","number","idcard","digit","safe-password","password","nickname"].includes(e)},value:{type:[String,Number]},onBlur:{type:Function,default:()=>({})},onChange:{type:Function,default:()=>({})},onClear:{type:Function,default:()=>({})},onClick:{type:Function,default:()=>({})},onEnter:{type:Function,default:()=>({})},onFocus:{type:Function,default:()=>({})},onKeyboardheightchange:{type:Function,default:()=>({})},onNicknamereview:{type:Function,default:()=>({})},onValidate:{type:Function,default:()=>({})}};const F=`${a}-input`;const N=c(e({name:F,options:{styleIsolation:"shared"},inject:{[V.FormKey]:{default:null}},externalClasses:[`${a}-class`,`${a}-class-prefix-icon`,`${a}-class-label`,`${a}-class-input`,`${a}-class-clearable`,`${a}-class-suffix`,`${a}-class-suffix-icon`,`${a}-class-tips`],components:{TIcon:s},props:{...$},emits:["blur","change","clear","click","enter","focus","keyboardheightchange","nicknamereview","validate","update:value"],data(){return{prefix:a,classPrefix:F,classBasePrefix:a,showClearIcon:!0,tools:t,dataValue:l(this.value,this.defaultValue)}},computed:{},watch:{prefixIcon:{handler(e){this._prefixIcon=o(e)},immediate:!0},suffixIcon:{handler(e){this._suffixIcon=o(e)},immediate:!0},clearable:{handler(e){this._clearIcon=o(e,"close-circle-filled")},immediate:!0},clearTrigger:"updateClearIconVisible",disabled:"updateClearIconVisible",readonly:"updateClearIconVisible",value:{handler(e){this.dataValue=e,i().then((()=>{this.dataValue=e,this[V.FormKey]&&this[V.FormKey].onValueChange&&this[V.FormKey].onValueChange(e)}))}}},mounted(){const{value:e,defaultValue:a}=this;this.updateValue(l(e,a,"")),this.updateClearIconVisible()},methods:{getInputClass:function(e,a,s,t){const l=[`${e}__control`];return s&&l.push(`${e}--${s}`),t&&l.push(`${e}__control--disabled`),l.join(" ")},updateValue(e){this.dataValue=e;const{allowInputOverMax:a,maxcharacter:s,maxlength:t}=this;if(!a&&s&&s>0&&!Number.isNaN(s)){const{length:a,characters:t}=r("maxcharacter",e,s);i().then((()=>{this.dataValue=t})),this.count=a}else if(!a&&t&&t>0&&!Number.isNaN(t)){const{length:a,characters:s}=r("maxlength",e,t);i().then((()=>{this.data