UNPKG

6.44 kBJavaScriptView Raw
1module.exports=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=279)}({0:function(e,t){e.exports=function(e,t,n,r,i,o){var a,s=e=e||{},u=typeof e.default;"object"!==u&&"function"!==u||(a=e,s=e.default);var l="function"==typeof s?s.options:s;t&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),i&&(l._scopeId=i);var p;if(o?(p=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},l._ssrRegister=p):r&&(p=r),p){var d=l.functional,h=d?l.render:l.beforeCreate;d?(l._injectStyles=p,l.render=function(e,t){return p.call(t),h(e,t)}):l.beforeCreate=h?[].concat(h,p):[p]}return{esModule:a,exports:s,options:l}}},1:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return o}),n.d(t,"b",function(){return a});var r={props:{disabled:{type:Boolean},type:{type:String,default:"default"},size:{type:String,default:"default"},nativeType:{type:String,default:"button"},plain:{type:Boolean},loadingColor:{type:Object,default:function(){return{default:"#d6d6d6",danger:"#e04b00",warning:"#ff9900"}}},loading:{type:Boolean},ripple:{type:Boolean}}},i={inject:{vxFormItem:{default:"vxFormItem"}},props:{disabled:{type:Boolean},clearable:{type:Boolean,default:!0},nativeType:{type:String,default:"text"},readonly:{type:Boolean},value:{type:[String,Number]},placeholder:{type:String},autocomplete:{type:String},autofocus:{type:String},maxlength:{type:Number},name:{type:String,default:function(){return Math.random().toString(36).substr(2)}},checked:{type:Boolean},validateEvent:{type:Boolean,default:!0},arrow:{type:Boolean,default:!1},arrowProps:{type:Object},border:{type:Boolean,default:!0},autoIntoView:{type:Boolean,default:!0},size:{type:String,default:"default"}},data:function(){return{isFocus:!1}},methods:{handleFocusIn:function(e){this.isFocus=!0;var t=e.target;this.autoIntoView&&void 0!==t.ontouchstart&&window.addEventListener("resize",function(){t.scrollIntoView&&t.scrollIntoView()},{once:!0})},handleFocusOut:function(e){this.isFocus=!1,this.eDispatch("ElFormItem","el.form.blur",[e.target.value])},handleChange:function(e){this.$emit("change",e.target.value)},handleInput:function(e){var t=e.target?e.target.value:e;this.$emit("input",t),this.eDispatch("ElFormItem","el.form.change",[t])},eDispatch:function(){this.validateEvent&&this.dispatch&&this.dispatch.apply(this,arguments)}}},o={methods:{change:function(e){this.active!==e&&this.$emit("update:active",e).$emit("change",e)}},props:{active:{type:[Number,String,Object],required:!0},layout:{type:String,default:"default"}}},a={props:{history:{type:Boolean,default:!0}},methods:{getPushURL:function(){var e=window.location.hash;this.pushString="popup="+Math.random().toString(36).substr(2);var t=[window.location.href.split("#")[0],e];return t.push(e?-1===e.indexOf("?")&&-1===e.indexOf("=")?"?":"&":"#"),t.push(this.pushString),t.join("")},pushState:function(){var e=this;this.history&&(this.pushString&&this.isCurrentPopup()&&window.history.back(),setTimeout(function(){window.history.pushState({},"",e.getPushURL()),window.addEventListener("popstate",e.handlePopstate)},16))},handlePopstate:function(){-1===window.location.href.indexOf(this.pushString)&&(this.$emit("update:open",!1).$emit("close"),this.popStateBack&&this.popStateBack(),window.removeEventListener("popstate",this.handlePopstate))},goBack:function(){this.history&&this.isCurrentPopup()&&(window.removeEventListener("popstate",this.handlePopstate),history.back())},isCurrentPopup:function(){return window.location.href.indexOf(this.pushString)===window.location.href.length-this.pushString.length}}}},129:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(71),i=n(130),o=n(0),a=o(r.a,i.a,!1,null,null,null);t.default=a.exports},130:function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("label",{class:["vx-textarea--wrapper","vx-textarea--size-"+e.size,{"is-disabled":e.disabled,"is-focus":e.isFocus,"vx-textarea--enter-number":e.enterNumber}],on:{focusin:e.handleFocusIn,focusout:e.handleFocusOut}},[n("div",{staticClass:"vx-textarea--inner"},[n("div",{staticClass:"vx-textarea--shadow"}),n("textarea",e._g(e._b({},"textarea",e.$$props,!1),e.$$listeners))]),e.enterNumber&&e.maxlength?n("em",[e._v("\n "+e._s(e.value.length)+"/"+e._s(e.maxlength)+"\n ")]):e._e()])},i=[],o={render:r,staticRenderFns:i};t.a=o},2:function(e,t){e.exports=require("babel-runtime/helpers/extends")},279:function(e,t,n){e.exports=n(129)},71:function(e,t,n){"use strict";var r=n(2),i=n.n(r),o=n(1);t.a={name:"XTextarea",componentName:"XTextarea",mixins:[o.c],props:i()({},o.c.props,{enterNumber:{type:Boolean,default:!1}}),computed:{$$props:function(){return i()({},this.$props,this.$attrs)},$$listeners:function(){return i()({},this.$listeners,{change:this.handleChange,input:this.handleInput})}},watch:{value:function(e){this.$$textarea.value!==e&&this.renderAutoHeight(e)}},mounted:function(){this.$$textarea=this.$el.querySelector("textarea"),this.$$inner=this.$el.querySelector(".vx-textarea--inner"),this.$$shadow=this.$el.querySelector(".vx-textarea--shadow"),this.renderAutoHeight(this.$$textarea.value),window.addEventListener("resize",this.handleResize,!1)},beforeDestroy:function(){window.removeEventListener("resize",this.handleResize)},methods:{handleResize:function(){this.renderAutoHeight(this.$$textarea.value)},handleInput:function(e){var t=e.target.value;this.renderAutoHeight(t),this.$emit("input",t),this.eDispatch("ElFormItem","el.form.change",[t])},renderAutoHeight:function(e){var t=this;requestAnimationFrame(function(){t.$$shadow.innerHTML=e.replace(/(\r|\n)$/,'<br/><span style="color:transparent">s</span>').replace(/(\r|\n)/g,"<br/>"),t.$$inner.style.height=t.$$shadow.offsetHeight+"px"})}}}}});
\No newline at end of file