import{y as e,o as t,c as r,w as i,a as n,n as a,f as l,e as s,t as o,B as u,k as d,l as f,i as p,m as c,a3 as h,I as m}from"./index-4ddb689d.js";import{_ as g}from"./u-icon.e981d1c2.js";import{r as y}from"./uni-app.es.24af5d4f.js";import{_ as b}from"./_plugin-vue_export-helper.1b428a4d.js";function v(e,t,r){}const S={methods:{dispatch(e,t,r){let i=this.$parent||this.$root,n=i.$options.name;for(;i&&(!n||n!==e);)i=i.$parent,i&&(n=i.$options.name);i&&i[t](r)},broadcast(e,t,r){v.call(this,e,t,r)}}};function _(){return _=Object.assign||function(e){for(var t=1;t=a)return e;switch(e){case"%s":return String(t[i++]);case"%d":return Number(t[i++]);case"%j":try{return JSON.stringify(t[i++])}catch(r){return"[Circular]"}break;default:return e}})),s=t[i];i()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,url:new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$","i"),hex:/^#?([a-f0-9]{6}|[a-f0-9]{3})$/i},I={integer:function(e){return I.number(e)&&parseInt(e,10)===e},float:function(e){return I.number(e)&&!I.integer(e)},array:function(e){return Array.isArray(e)},regexp:function(e){if(e instanceof RegExp)return!0;try{return!!new RegExp(e)}catch(t){return!1}},date:function(e){return"function"==typeof e.getTime&&"function"==typeof e.getMonth&&"function"==typeof e.getYear},number:function(e){return!isNaN(e)&&"number"==typeof+e},object:function(e){return"object"==typeof e&&!I.array(e)},method:function(e){return"function"==typeof e},email:function(e){return"string"==typeof e&&!!e.match(B.email)&&e.length<255},url:function(e){return"string"==typeof e&&!!e.match(B.url)},hex:function(e){return"string"==typeof e&&!!e.match(B.hex)}};var E={required:k,whitespace:function(e,t,r,i,n){(/^\s+$/.test(t)||""===t)&&i.push(O(n.messages.whitespace,e.fullField))},type:function(e,t,r,i,n){if(e.required&&void 0===t)k(e,t,r,i,n);else{var a=e.type;["integer","float","array","regexp","object","method","email","number","date","url","hex"].indexOf(a)>-1?I[a](t)||i.push(O(n.messages.types[a],e.fullField,e.type)):a&&typeof t!==e.type&&i.push(O(n.messages.types[a],e.fullField,e.type))}},range:function(e,t,r,i,n){var a="number"==typeof e.len,l="number"==typeof e.min,s="number"==typeof e.max,o=t,u=null,d="number"==typeof t,f="string"==typeof t,p=Array.isArray(t);if(d?u="number":f?u="string":p&&(u="array"),!u)return!1;p&&(o=t.length),f&&(o=t.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"_").length),a?o!==e.len&&i.push(O(n.messages[u].len,e.fullField,e.len)):l&&!s&&oe.max?i.push(O(n.messages[u].max,e.fullField,e.max)):l&&s&&(oe.max)&&i.push(O(n.messages[u].range,e.fullField,e.min,e.max))},enum:function(e,t,r,i,n){e.enum=Array.isArray(e.enum)?e.enum:[],-1===e.enum.indexOf(t)&&i.push(O(n.messages.enum,e.fullField,e.enum.join(", ")))},pattern:function(e,t,r,i,n){if(e.pattern)if(e.pattern instanceof RegExp)e.pattern.lastIndex=0,e.pattern.test(t)||i.push(O(n.messages.pattern.mismatch,e.fullField,t,e.pattern));else if("string"==typeof e.pattern){new RegExp(e.pattern).test(t)||i.push(O(n.messages.pattern.mismatch,e.fullField,t,e.pattern))}}};function $(e,t,r,i,n){var a=e.type,l=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t,a)&&!e.required)return r();E.required(e,t,i,l,n,a),A(t,a)||E.type(e,t,i,l,n)}r(l)}var D={string:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t,"string")&&!e.required)return r();E.required(e,t,i,a,n,"string"),A(t,"string")||(E.type(e,t,i,a,n),E.range(e,t,i,a,n),E.pattern(e,t,i,a,n),!0===e.whitespace&&E.whitespace(e,t,i,a,n))}r(a)},method:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&E.type(e,t,i,a,n)}r(a)},number:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(""===t&&(t=void 0),A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&(E.type(e,t,i,a,n),E.range(e,t,i,a,n))}r(a)},boolean:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&E.type(e,t,i,a,n)}r(a)},regexp:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),A(t)||E.type(e,t,i,a,n)}r(a)},integer:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&(E.type(e,t,i,a,n),E.range(e,t,i,a,n))}r(a)},float:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&(E.type(e,t,i,a,n),E.range(e,t,i,a,n))}r(a)},array:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t,"array")&&!e.required)return r();E.required(e,t,i,a,n,"array"),A(t,"array")||(E.type(e,t,i,a,n),E.range(e,t,i,a,n))}r(a)},object:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&E.type(e,t,i,a,n)}r(a)},enum:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n),void 0!==t&&E.enum(e,t,i,a,n)}r(a)},pattern:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t,"string")&&!e.required)return r();E.required(e,t,i,a,n),A(t,"string")||E.pattern(e,t,i,a,n)}r(a)},date:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();var l;if(E.required(e,t,i,a,n),!A(t))l="number"==typeof t?new Date(t):t,E.type(e,l,i,a,n),l&&E.range(e,l.getTime(),i,a,n)}r(a)},url:$,hex:$,email:$,required:function(e,t,r,i,n){var a=[],l=Array.isArray(t)?"array":typeof t;E.required(e,t,i,a,n,l),r(a)},any:function(e,t,r,i,n){var a=[];if(e.required||!e.required&&i.hasOwnProperty(e.field)){if(A(t)&&!e.required)return r();E.required(e,t,i,a,n)}r(a)}};function V(){return{default:"Validation error on field %s",required:"%s is required",enum:"%s must be one of %s",whitespace:"%s cannot be empty",date:{format:"%s date %s is invalid for format %s",parse:"%s date could not be parsed, %s is invalid ",invalid:"%s date %s is invalid"},types:{string:"%s is not a %s",method:"%s is not a %s (function)",array:"%s is not an %s",object:"%s is not an %s",number:"%s is not a %s",date:"%s is not a %s",boolean:"%s is not a %s",integer:"%s is not an %s",float:"%s is not a %s",regexp:"%s is not a valid %s",email:"%s is not a valid %s",url:"%s is not a valid %s",hex:"%s is not a valid %s"},string:{len:"%s must be exactly %s characters",min:"%s must be at least %s characters",max:"%s cannot be longer than %s characters",range:"%s must be between %s and %s characters"},number:{len:"%s must equal %s",min:"%s cannot be less than %s",max:"%s cannot be greater than %s",range:"%s must be between %s and %s"},array:{len:"%s must be exactly %s in length",min:"%s cannot be less than %s in length",max:"%s cannot be greater than %s in length",range:"%s must be between %s and %s in length"},pattern:{mismatch:"%s value %s does not match pattern %s"},clone:function(){var e=JSON.parse(JSON.stringify(this));return e.clone=this.clone,e}}}var T=V();function N(e){this.rules=null,this._messages=T,this.define(e)}N.prototype={messages:function(e){return e&&(this._messages=C(V(),e)),this._messages},define:function(e){if(!e)throw new Error("Cannot configure a schema with no rules");if("object"!=typeof e||Array.isArray(e))throw new Error("Rules must be an object");var t,r;for(t in this.rules={},e)e.hasOwnProperty(t)&&(r=e[t],this.rules[t]=Array.isArray(r)?r:[r])},validate:function(e,t,r){var i=this;void 0===t&&(t={}),void 0===r&&(r=function(){});var n,a,l=e,s=t,o=r;if("function"==typeof s&&(o=s,s={}),!this.rules||0===Object.keys(this.rules).length)return o&&o(),Promise.resolve();if(s.messages){var u=this.messages();u===T&&(u=V()),C(u,s.messages),s.messages=u}else s.messages=this.messages();var d={};(s.keys||Object.keys(this.rules)).forEach((function(t){n=i.rules[t],a=l[t],n.forEach((function(r){var n=r;"function"==typeof n.transform&&(l===e&&(l=_({},l)),a=l[t]=n.transform(a)),(n="function"==typeof n?{validator:n}:_({},n)).validator=i.getValidationMethod(n),n.field=t,n.fullField=n.fullField||t,n.type=i.getType(n),n.validator&&(d[t]=d[t]||[],d[t].push({rule:n,value:a,source:l,field:t}))}))}));var f={};return j(d,s,(function(e,t){var r,i=e.rule,n=!("object"!==i.type&&"array"!==i.type||"object"!=typeof i.fields&&"object"!=typeof i.defaultField);function a(e,t){return _({},t,{fullField:i.fullField+"."+e})}function l(r){void 0===r&&(r=[]);var l=r;if(Array.isArray(l)||(l=[l]),!s.suppressWarning&&l.length&&N.warning("async-validator:",l),l.length&&i.message&&(l=[].concat(i.message)),l=l.map(P(i)),s.first&&l.length)return f[i.field]=1,t(l);if(n){if(i.required&&!e.value)return l=i.message?[].concat(i.message).map(P(i)):s.error?[s.error(i,O(s.messages.required,i.field))]:[],t(l);var o={};if(i.defaultField)for(var u in e.value)e.value.hasOwnProperty(u)&&(o[u]=i.defaultField);for(var d in o=_({},o,{},e.rule.fields))if(o.hasOwnProperty(d)){var p=Array.isArray(o[d])?o[d]:[o[d]];o[d]=p.map(a.bind(null,d))}var c=new N(o);c.messages(s.messages),e.rule.options&&(e.rule.options.messages=s.messages,e.rule.options.error=s.error),c.validate(e.value,e.rule.options||s,(function(e){var r=[];l&&l.length&&r.push.apply(r,l),e&&e.length&&r.push.apply(r,e),t(r.length?r:null)}))}else t(l)}n=n&&(i.required||!i.required&&e.value),i.field=e.field,i.asyncValidator?r=i.asyncValidator(i,e.value,l,e.source,s):i.validator&&(!0===(r=i.validator(i,e.value,l,e.source,s))?l():!1===r?l(i.message||i.field+" fails"):r instanceof Array?l(r):r instanceof Error&&l(r.message)),r&&r.then&&r.then((function(){return l()}),(function(e){return l(e)}))}),(function(e){!function(e){var t,r,i,n=[],a={};for(t=0;tnull}},props:{label:{type:String,default:""},prop:{type:String,default:""},borderBottom:{type:[String,Boolean],default:""},labelPosition:{type:String,default:""},labelWidth:{type:[String,Number],default:""},labelStyle:{type:Object,default:()=>({})},labelAlign:{type:String,default:""},rightIcon:{type:String,default:""},leftIcon:{type:String,default:""},leftIconStyle:{type:Object,default:()=>({})},rightIconStyle:{type:Object,default:()=>({})},required:{type:Boolean,default:!1},inputAlign:{type:String,default:""}},data:()=>({initialValue:"",validateState:"",validateMessage:"",errorType:["message"],fieldValue:"",parentData:{borderBottom:!0,labelWidth:90,labelPosition:"left",labelStyle:{},labelAlign:"left",inputAlign:"left"}}),watch:{validateState(e){this.broadcastInputError()},"uForm.errorType"(e){this.errorType=e,this.broadcastInputError()}},computed:{uLabelWidth(){return"left"==this.elLabelPosition?"true"===this.label||""===this.label?"auto":this.$u.addUnit(this.elLabelWidth):"100%"},showError(){return e=>!(this.errorType.indexOf("none")>=0)&&this.errorType.indexOf(e)>=0},elLabelWidth(){return 0!=this.labelWidth||""!=this.labelWidth?this.labelWidth:this.parentData.labelWidth?this.parentData.labelWidth:90},elLabelStyle(){return Object.keys(this.labelStyle).length?this.labelStyle:this.parentData.labelStyle?this.parentData.labelStyle:{}},elLabelPosition(){return this.labelPosition?this.labelPosition:this.parentData.labelPosition?this.parentData.labelPosition:"left"},elLabelAlign(){return this.labelAlign?this.labelAlign:this.parentData.labelAlign?this.parentData.labelAlign:"left"},elBorderBottom(){return""!==this.borderBottom?this.borderBottom:!this.parentData.borderBottom||this.parentData.borderBottom},elInputAlign(){return this.inputAlign?this.inputAlign:this.parentData.inputAlign?this.parentData.inputAlign:"left"}},methods:{broadcastInputError(){this.broadcast("u-input","onFormItemError","error"===this.validateState&&this.showError("border"))},setRules(){},getRules(){let e=this.parent.rules;return e=e?e[this.prop]:[],[].concat(e||[])},onFieldBlur(){this.validation("blur")},onFieldChange(){this.validation("change")},getFilteredRule(e=""){let t=this.getRules();return e?t.filter((t=>t.trigger&&-1!==t.trigger.indexOf(e))):t},getData(e,t,r){let i;if(e){i=JSON.parse(JSON.stringify(e));let r="",n=".",a="[",l="]";t=t.replace(/\s+/g,r)+n;let s=r;for(let e=0;e{})){this.fieldValue=this.getData(this.parent.model,this.prop);let r=this.getFilteredRule(e);if(!r||0===r.length)return t("");this.validateState="validating",new N({[this.prop]:r}).validate({[this.prop]:this.fieldValue},{firstFields:!0},((e,r)=>{this.validateState=e?"error":"success",this.validateMessage=e?e[0].message:"";let i=e?e[0].field:"";t(this.validateMessage,{state:this.validateState,key:i,msg:this.validateMessage})}))},resetField(){this.setData(this.parent.model,this.prop,this.initialValue),this.validateState="success"}},mounted(){this.parent=this.$u.$parent.call(this,"u-form"),this.parent&&(Object.keys(this.parentData).map((e=>{this.parentData[e]=this.parent[e]})),this.prop&&(this.parent.fields.push(this),this.errorType=this.parent.errorType,this.initialValue=this.fieldValue,this.$nextTick((()=>{this.setRules()}))))},beforeUnmount(){this.parent&&this.prop&&this.parent.fields.map(((e,t)=>{e===this&&this.parent.fields.splice(t,1)}))}},[["render",function(c,h,m,b,v,S){const _=f,w=y(e("u-icon"),g),x=p;return t(),r(x,{class:d(["u-form-item",{"u-border-bottom":S.elBorderBottom,"u-form-item__border-bottom--error":"error"===v.validateState&&S.showError("border-bottom")}])},{default:i((()=>[n(x,{class:"u-form-item__body",style:a({flexDirection:"left"==S.elLabelPosition?"row":"column"})},{default:i((()=>[n(x,{class:"u-form-item--left",style:a({width:S.uLabelWidth,flex:`0 0 ${S.uLabelWidth}`,marginBottom:"left"==S.elLabelPosition?0:"10rpx"})},{default:i((()=>[m.required||m.leftIcon||m.label?(t(),r(x,{key:0,class:"u-form-item--left__content"},{default:i((()=>[m.required?(t(),r(_,{key:0,class:"u-form-item--left__content--required"},{default:i((()=>[l("*")])),_:1})):s("",!0),m.leftIcon?(t(),r(x,{key:1,class:"u-form-item--left__content__icon"},{default:i((()=>[n(w,{name:m.leftIcon,"custom-style":m.leftIconStyle},null,8,["name","custom-style"])])),_:1})):s("",!0),n(x,{class:"u-form-item--left__content__label",style:a([S.elLabelStyle,{"justify-content":"left"==S.elLabelAlign?"flex-start":"center"==S.elLabelAlign?"center":"flex-end"}])},{default:i((()=>[l(o(m.label),1)])),_:1},8,["style"])])),_:1})):s("",!0)])),_:1},8,["style"]),n(x,{class:"u-form-item--right u-flex"},{default:i((()=>[n(x,{class:"u-form-item--right__content"},{default:i((()=>[n(x,{class:"u-form-item--right__content__slot",style:a("left"==S.elLabelPosition&&"right"==S.elInputAlign?"text-align:right;display: inline-block;line-height:initial;":"")},{default:i((()=>[u(c.$slots,"default",{},void 0,!0)])),_:3},8,["style"]),c.$slots.right||m.rightIcon?(t(),r(x,{key:0,class:"u-form-item--right__content__icon u-flex"},{default:i((()=>[m.rightIcon?(t(),r(w,{key:0,"custom-style":m.rightIconStyle,name:m.rightIcon},null,8,["custom-style","name"])):s("",!0),u(c.$slots,"right",{},void 0,!0)])),_:3})):s("",!0)])),_:3})])),_:3})])),_:3},8,["style"]),"error"===v.validateState&&S.showError("message")?(t(),r(x,{key:0,class:"u-form-item__message",style:a({paddingLeft:"left"==S.elLabelPosition?c.$u.addUnit(S.elLabelWidth):"0",textAlign:"right"==S.elInputAlign?"right":"left"})},{default:i((()=>[l(o(v.validateMessage),1)])),_:1},8,["style"])):s("",!0)])),_:3},8,["class"])}],["__scopeId","data-v-283017dc"]]);const W=b({name:"u-input",emits:["update:modelValue","input","change","blur","focus","click","touchstart"],mixins:[S],props:{value:{type:[String,Number],default:""},modelValue:{type:[String,Number],default:""},type:{type:String,default:"text"},inputAlign:{type:String,default:""},placeholder:{type:String,default:"请输入内容"},disabled:{type:Boolean,default:!1},maxlength:{type:[Number,String],default:140},placeholderStyle:{type:String,default:"color: #c0c4cc;"},confirmType:{type:String,default:"done"},customStyle:{type:Object,default:()=>({})},fixed:{type:Boolean,default:!1},focus:{type:Boolean,default:!1},passwordIcon:{type:Boolean,default:!0},border:{type:Boolean,default:!1},borderColor:{type:String,default:"#dcdfe6"},autoHeight:{type:Boolean,default:!0},selectOpen:{type:Boolean,default:!1},height:{type:[Number,String],default:""},clearable:{type:[Boolean,String]},cursorSpacing:{type:[Number,String],default:0},selectionStart:{type:[Number,String],default:-1},selectionEnd:{type:[Number,String],default:-1},trim:{type:Boolean,default:!0},showConfirmbar:{type:Boolean,default:!0},adjustPosition:{type:Boolean,default:!0},backgroundColor:{type:String},padding:{type:String}},data:()=>({defaultValue:"",inputHeight:70,textareaHeight:100,validateState:!1,focused:!1,showPassword:!1,lastValue:"",uForm:{inputAlign:"",clearable:""}}),watch:{valueCom(e,t){this.defaultValue=e,e!=t&&"select"==this.type&&this.handleInput({detail:{value:e}})}},computed:{valueCom(){return this.modelValue},inputAlignCom(){return this.inputAlign||this.uForm.inputAlign||"left"},clearableCom(){return"boolean"==typeof this.clearable?this.clearable:"boolean"!=typeof this.uForm.clearable||this.uForm.clearable},inputMaxlength(){return Number(this.maxlength)},getStyle(){let e={};return e.minHeight=this.height?this.height+"rpx":"textarea"==this.type?this.textareaHeight+"rpx":this.inputHeight+"rpx",e=Object.assign(e,this.customStyle),e},getCursorSpacing(){return Number(this.cursorSpacing)},uSelectionStart(){return String(this.selectionStart)},uSelectionEnd(){return String(this.selectionEnd)}},created(){this.defaultValue=this.valueCom},mounted(){let e=this.$u.$parent.call(this,"u-form");e&&Object.keys(this.uForm).map((t=>{this.uForm[t]=e[t]}))},methods:{handleInput(e){let t=e.detail.value;this.trim&&(t=this.$u.trim(t)),this.$emit("input",t),this.$emit("update:modelValue",t),this.defaultValue=t,setTimeout((()=>{this.dispatch("u-form-item","onFieldChange",t)}),40)},handleBlur(e){setTimeout((()=>{this.focused=!1}),100),this.$emit("blur",e.detail.value),setTimeout((()=>{this.dispatch("u-form-item","onFieldBlur",e.detail.value)}),40)},onFormItemError(e){this.validateState=e},onFocus(e){this.focused=!0,this.$emit("focus")},onConfirm(e){this.$emit("confirm",e.detail.value)},onClear(e){this.$emit("input",""),this.$emit("update:modelValue","")},inputClick(){this.$emit("click")}}},[["render",function(l,o,u,f,b,v){const S=h,_=m,w=y(e("u-icon"),g),x=p;return t(),r(x,{class:d(["u-input",{"u-input--border":u.border,"u-input--error":b.validateState}]),style:a({padding:u.padding?u.padding:`0 ${u.border?20:0}rpx`,borderColor:u.borderColor,textAlign:v.inputAlignCom,backgroundColor:u.backgroundColor}),onClick:c(v.inputClick,["stop"])},{default:i((()=>["textarea"==u.type?(t(),r(S,{key:0,class:"u-input__input u-input__textarea",style:a([v.getStyle]),value:b.defaultValue,placeholder:u.placeholder,placeholderStyle:u.placeholderStyle,disabled:u.disabled,maxlength:v.inputMaxlength,fixed:u.fixed,focus:u.focus,autoHeight:u.autoHeight,"selection-end":v.uSelectionEnd,"selection-start":v.uSelectionStart,"cursor-spacing":v.getCursorSpacing,"show-confirm-bar":u.showConfirmbar,"adjust-position":u.adjustPosition,onInput:v.handleInput,onBlur:v.handleBlur,onFocus:v.onFocus,onConfirm:v.onConfirm},null,8,["style","value","placeholder","placeholderStyle","disabled","maxlength","fixed","focus","autoHeight","selection-end","selection-start","cursor-spacing","show-confirm-bar","adjust-position","onInput","onBlur","onFocus","onConfirm"])):(t(),r(_,{key:1,class:"u-input__input",type:"password"==u.type?"text":u.type,style:a([v.getStyle]),value:b.defaultValue,password:"password"==u.type&&!b.showPassword,placeholder:u.placeholder,placeholderStyle:u.placeholderStyle,disabled:u.disabled||"select"===u.type,maxlength:v.inputMaxlength,focus:u.focus,confirmType:u.confirmType,"cursor-spacing":v.getCursorSpacing,"selection-end":v.uSelectionEnd,"selection-start":v.uSelectionStart,"show-confirm-bar":u.showConfirmbar,"adjust-position":u.adjustPosition,onFocus:v.onFocus,onBlur:v.handleBlur,onInput:v.handleInput,onConfirm:v.onConfirm},null,8,["type","style","value","password","placeholder","placeholderStyle","disabled","maxlength","focus","confirmType","cursor-spacing","selection-end","selection-start","show-confirm-bar","adjust-position","onFocus","onBlur","onInput","onConfirm"])),n(x,{class:"u-input__right-icon u-flex"},{default:i((()=>[v.clearableCom&&""!=v.valueCom&&b.focused?(t(),r(x,{key:0,class:"u-input__right-icon__clear u-input__right-icon__item",onClick:v.onClear},{default:i((()=>[n(w,{size:"32",name:"close-circle-fill",color:"#c0c4cc"})])),_:1},8,["onClick"])):s("",!0),u.passwordIcon&&"password"==u.type?(t(),r(x,{key:1,class:"u-input__right-icon__clear u-input__right-icon__item"},{default:i((()=>[n(w,{size:"32",name:b.showPassword?"eye-fill":"eye",color:"#c0c4cc",onClick:o[0]||(o[0]=e=>b.showPassword=!b.showPassword)},null,8,["name"])])),_:1})):s("",!0),"select"==u.type?(t(),r(x,{key:2,class:d(["u-input__right-icon--select u-input__right-icon__item",{"u-input__right-icon--select--reverse":u.selectOpen}])},{default:i((()=>[n(w,{name:"arrow-down-fill",size:"26",color:"#c0c4cc"})])),_:1},8,["class"])):s("",!0)])),_:1})])),_:1},8,["class","style","onClick"])}],["__scopeId","data-v-e8af4863"]]);const R=b({name:"u-form",props:{model:{type:Object,default:()=>({})},errorType:{type:Array,default:()=>["message","toast"]},borderBottom:{type:Boolean,default:!0},labelPosition:{type:String,default:"left"},labelWidth:{type:[String,Number],default:90},labelAlign:{type:String,default:"left"},labelStyle:{type:Object,default:()=>({})},inputAlign:{type:String,default:"left"},clearable:{type:Boolean,default:!0}},provide(){return{uForm:this}},data:()=>({rules:{}}),created(){this.fields=[]},methods:{setRules(e){this.rules=e},resetFields(){this.fields.map((e=>{e.resetField()}))},validate(e){return new Promise((t=>{let r=!0,i=0,n=[],a=[];this.fields.map((l=>{l.validation("",((l,s)=>{l&&(r=!1,n.push(l),a.push(s)),++i===this.fields.length&&(t(r,a[0]),-1===this.errorType.indexOf("none")&&this.errorType.indexOf("toast")>=0&&n.length&&this.$u.toast(n[0]),"function"==typeof e&&e(r,a[0]))}))}))}))}}},[["render",function(e,n,a,l,s,o){const d=p;return t(),r(d,{class:"u-form"},{default:i((()=>[u(e.$slots,"default",{},void 0,!0)])),_:3})}],["__scopeId","data-v-90b2afa7"]]);export{S as E,L as _,W as a,R as b};