12345678910 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uview-ui/components/u-form-item/u-form-item"],{"125e":function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=a(i("affa")),r=a(i("9257"));function a(t){return t&&t.__esModule?t:{default:t}}function l(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}r.default.warning=function(){};var o={name:"u-form-item",mixins:[n.default],inject:{uForm:{default:function(){return null}}},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:function(){return{}}},labelAlign:{type:String,default:""},rightIcon:{type:String,default:""},leftIcon:{type:String,default:""},leftIconStyle:{type:Object,default:function(){return{}}},rightIconStyle:{type:Object,default:function(){return{}}},required:{type:Boolean,default:!1}},data:function(){return{initialValue:"",validateState:"",validateMessage:"",errorType:["message"],fieldValue:"",parentData:{borderBottom:!0,labelWidth:90,labelPosition:"left",labelStyle:{},labelAlign:"left"}}},watch:{validateState:function(t){this.broadcastInputError()},"uForm.errorType":function(t){this.errorType=t,this.broadcastInputError()}},computed:{uLabelWidth:function(){return"left"==this.elLabelPosition?"true"===this.label||""===this.label?"auto":this.$u.addUnit(this.elLabelWidth):"100%"},showError:function(){var t=this;return function(e){return!(t.errorType.indexOf("none")>=0)&&t.errorType.indexOf(e)>=0}},elLabelWidth:function(){return 0!=this.labelWidth||""!=this.labelWidth?this.labelWidth:this.parentData.labelWidth?this.parentData.labelWidth:90},elLabelStyle:function(){return Object.keys(this.labelStyle).length?this.labelStyle:this.parentData.labelStyle?this.parentData.labelStyle:{}},elLabelPosition:function(){return this.labelPosition?this.labelPosition:this.parentData.labelPosition?this.parentData.labelPosition:"left"},elLabelAlign:function(){return this.labelAlign?this.labelAlign:this.parentData.labelAlign?this.parentData.labelAlign:"left"},elBorderBottom:function(){return""!==this.borderBottom?this.borderBottom:!this.parentData.borderBottom||this.parentData.borderBottom}},methods:{broadcastInputError:function(){this.broadcast("u-input","on-form-item-error","error"===this.validateState&&this.showError("border"))},setRules:function(){var t=this;this.$on("on-form-blur",t.onFieldBlur),this.$on("on-form-change",t.onFieldChange)},getRules:function(){var t=this.parent.rules;return t=t?t[this.prop]:[],[].concat(t||[])},onFieldBlur:function(){this.validation("blur")},onFieldChange:function(){this.validation("change")},getFilteredRule:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=this.getRules();return t?e.filter((function(e){return e.trigger&&-1!==e.trigger.indexOf(t)})):e},validation:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};this.fieldValue=this.parent.model[this.prop];var n=this.getFilteredRule(t);if(!n||0===n.length)return i("");this.validateState="validating";var a=new r.default(l({},this.prop,n));a.validate(l({},this.prop,this.fieldValue),{firstFields:!0},(function(t,n){e.validateState=t?"error":"success",e.validateMessage=t?t[0].message:"",i(e.validateMessage)}))},resetField:function(){this.parent.model[this.prop]=this.initialValue,this.validateState="success"}},mounted:function(){var t=this;this.parent=this.$u.$parent.call(this,"u-form"),this.parent&&(Object.keys(this.parentData).map((function(e){t.parentData[e]=t.parent[e]})),this.prop&&(this.parent.fields.push(this),this.errorType=this.parent.errorType,this.initialValue=this.fieldValue,this.$nextTick((function(){t.setRules()}))))},beforeDestroy:function(){var t=this;this.parent&&this.prop&&this.parent.fields.map((function(e,i){e===t&&t.parent.fields.splice(i,1)}))}};e.default=o},"23b2":function(t,e,i){"use strict";i.d(e,"b",(function(){return r})),i.d(e,"c",(function(){return a})),i.d(e,"a",(function(){return n}));var n={uIcon:function(){return i.e("uview-ui/components/u-icon/u-icon").then(i.bind(null,"c4c2"))}},r=function(){var t=this,e=t.$createElement,i=(t._self._c,"error"===t.validateState&&t.showError("border-bottom")),n=t.required||t.leftIcon||t.label?t.__get_style([t.elLabelStyle,{"justify-content":"left"==t.elLabelAlign?"flex-start":"center"==t.elLabelAlign?"center":"flex-end"}]):null,r="error"===t.validateState&&t.showError("message"),a=r&&"left"==t.elLabelPosition?t.$u.addUnit(t.elLabelWidth):null;t.$mp.data=Object.assign({},{$root:{m0:i,s0:n,m1:r,g0:a}})},a=[]},"88d6":function(t,e,i){"use strict";i.r(e);var n=i("125e"),r=i.n(n);for(var a in n)"default"!==a&&function(t){i.d(e,t,(function(){return n[t]}))}(a);e["default"]=r.a},bbfd:function(t,e,i){"use strict";i.r(e);var n=i("23b2"),r=i("88d6");for(var a in r)"default"!==a&&function(t){i.d(e,t,(function(){return r[t]}))}(a);i("be84");var l,o=i("f0c5"),u=Object(o["a"])(r["default"],n["b"],n["c"],!1,null,"63796f6d",null,!1,n["a"],l);e["default"]=u.exports},be84:function(t,e,i){"use strict";var n=i("f533"),r=i.n(n);r.a},f533:function(t,e,i){}}]);
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'uview-ui/components/u-form-item/u-form-item-create-component',
- {
- 'uview-ui/components/u-form-item/u-form-item-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('543d')['createComponent'](__webpack_require__("bbfd"))
- })
- },
- [['uview-ui/components/u-form-item/u-form-item-create-component']]
- ]);
|