UNPKG

20.3 kBJavaScriptView Raw
1module.exports=function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=312)}({0:function(t,e){t.exports=function(t,e,n,i,o,r){var a,s=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(a=t,s=t.default);var u="function"==typeof s?s.options:s;e&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0),n&&(u.functional=!0),o&&(u._scopeId=o);var c;if(r?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},u._ssrRegister=c):i&&(c=i),c){var p=u.functional,h=p?u.render:u.beforeCreate;p?(u._injectStyles=c,u.render=function(t,e){return c.call(e),h(t,e)}):u.beforeCreate=h?[].concat(h,c):[c]}return{esModule:a,exports:s,options:u}}},1:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return o}),n.d(e,"d",function(){return r}),n.d(e,"b",function(){return a});var i={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}}},o={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(t){this.isFocus=!0;var e=t.target;this.autoIntoView&&void 0!==e.ontouchstart&&window.addEventListener("resize",function(){e.scrollIntoView&&e.scrollIntoView()},{once:!0})},handleFocusOut:function(t){this.isFocus=!1,this.eDispatch("ElFormItem","el.form.blur",[t.target.value])},handleChange:function(t){this.$emit("change",t.target.value)},handleInput:function(t){var e=t.target?t.target.value:t;this.$emit("input",e),this.eDispatch("ElFormItem","el.form.change",[e])},eDispatch:function(){this.validateEvent&&this.dispatch&&this.dispatch.apply(this,arguments)}}},r={methods:{change:function(t){this.active!==t&&this.$emit("update:active",t).$emit("change",t)}},props:{active:{type:[Number,String,Object],required:!0},layout:{type:String,default:"default"}}},a={props:{history:{type:Boolean,default:!0}},methods:{getPushURL:function(){var t=window.location.hash;this.pushString="popup="+Math.random().toString(36).substr(2);var e=[window.location.href.split("#")[0],t];return e.push(t?-1===t.indexOf("?")&&-1===t.indexOf("=")?"?":"&":"#"),e.push(this.pushString),e.join("")},pushState:function(){var t=this;this.history&&(this.pushString&&this.isCurrentPopup()&&window.history.back(),setTimeout(function(){window.history.pushState({},"",t.getPushURL()),window.addEventListener("popstate",t.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}}}},10:function(t,e,n){"use strict";var i=n(1),o=n(11),r=n(4);e.a={name:"Popup",componentName:"Popup",components:{Overlay:o.a,Arrow:r.a},mixins:[i.b],props:{open:{type:Boolean,default:!1},full:{type:Boolean,default:!1},direction:{type:String,default:"bottom"},fastClose:{type:Boolean,default:!0},showClose:{type:Boolean,default:!1},title:{type:String},overlayOpacity:{type:Number}},data:function(){return{afterOpen:!1}},computed:{innerClasses:function(){return["vx-popup--inner","vx-popup--"+this.direction,{"is-full":this.full}]}},mounted:function(){var t=this;this.open&&requestAnimationFrame(function(){t.pushState(),t.$el.style.display="block",t.handleEnter()})},watch:{open:function(t){var e=this;t&&requestAnimationFrame(function(){e.pushState(),e.$el.style.display="block"})}},methods:{handleEnter:function(){this.afterOpen=!0,this.$emit("open")},close:function(){this.$emit("update:open",!1).$emit("close")},handleClose:function(){this.fastClose&&this.close()},handleClose2:function(t){this.fastClose&&t.target===this.$el.querySelector(".vx-popup--inner")&&this.close()},handleLeave:function(){this.goBack(),this.$el.style.display="none",this.afterOpen=!1,this.$emit("after-close")}}}},106:function(t,e){t.exports=require("babel-runtime/core-js/get-iterator")},107:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("popup",{attrs:{open:t.open,history:t.history,"fast-close":!1},on:{close:t.handleClose}},[n("div",{class:["vx-flexbox","vx-datetime-picker--header"],attrs:{slot:"header"},slot:"header"},[n("button",{staticClass:"vx-datetime-picker--cancel",attrs:{type:"button"},on:{click:t.handleClose}},[t._v(t._s(t.cancelText))]),n("div",{class:["vx-flexbox--item","vx-datetime-picker--today"]}),n("button",{staticClass:"vx-datetime-picker--confirm",attrs:{type:"button"},on:{click:t.handleConfirm}},[t._v(t._s(t.confirmText))])]),n("div",{class:["vx-flexbox","vx-datetime-picker"]},t._l(t.pickers,function(e,i){return t.pickers?n("picker",{key:i+"-"+e.type,class:["vx-flexbox--item","vx-datetime-picker--item"],attrs:{index:i+"-"+e.type,"data-type":e.type,value:e.value,placeholder:e.placeholder,options:e.options},on:{change:function(n){t.handleChange(n,i,e.type)}}}):t._e()}),1)])},o=[],r={render:i,staticRenderFns:o};e.a=r},11:function(t,e,n){"use strict";var i=n(8),o=n(17),r=n(0),a=r(i.a,o.a,!0,null,null,null);e.a=a.exports},12:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(10),o=n(19),r=n(0),a=r(i.a,o.a,!1,null,null,null);e.default=a.exports},17:function(t,e,n){"use strict";var i=function(t,e){var n=e._c;return n("transition",{attrs:{name:"popup-fade"}},[n("div",e._g(e._b({directives:[{name:"show",rawName:"v-show",value:e.props.open,expression:"props.open"}],class:["vx-overlay",e.data.staticClass,e.data.class],style:Object.assign({opacity:""+e.props.opacity},e.data.style)},"div",e.data.attrs,!1),e.listeners),[e._t("default")],2)])},o=[],r={render:i,staticRenderFns:o};e.a=r},19:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vx-popup"},[t.full?t._e():n("overlay",{attrs:{opacity:t.overlayOpacity,open:t.open},on:{click:t.handleClose}}),t.$slots.inner?n("transition",{attrs:{name:"popup-fade"},on:{"after-enter":t.handleEnter,"after-leave":t.handleLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}]},[t._t("inner")],2)]):n("transition",{attrs:{name:t.full?"popup-full-slide-"+t.direction:"popup-slide-"+t.direction},on:{"after-enter":t.handleEnter,"after-leave":t.handleLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],class:t.innerClasses,on:{click:t.handleClose2}},[t.title&&!t.showClose?n("div",{staticClass:"vx-popup--nav"},[n("button",{attrs:{type:"button"},on:{click:t.close}},[n("arrow",{attrs:{direction:"left",color:"#666",size:"0.24rem"}})],1),n("div",{staticClass:"vx-popup--nav-title"},[t._v(t._s(t.title))])]):t.showClose&&t.full?n("div",{staticClass:"vx-popup--nav"},[n("div",{staticClass:"vx-popup--nav-title"},[t._v(t._s(t.title))]),n("i",{staticClass:"vx-popup--close",on:{click:t.close}})]):t._t("header"),"center"===t.direction?n("div",{staticClass:"vx-popup--body"},[t.showClose?n("i",{staticClass:"vx-popup--close",on:{click:t.close}}):t._e(),t._t("default",null,{open:t.afterOpen})],2):n("div",{staticClass:"vx-popup--body is-flex"},[t._t("default",null,{open:t.afterOpen})],2),t._t("footer")],2)])],1)},o=[],r={render:i,staticRenderFns:o};e.a=r},23:function(t,e){t.exports=require("babel-runtime/core-js/array/from")},27:function(t,e,n){"use strict";var i=n(23),o=n.n(i),r=n(46),a=function(t,e,n,i){if(t!==e&&"number"==typeof t){e=e||0,n=n||2;!function o(){if(t+=(e-t)/n,Math.abs(e-t)<1)return void i(e,!0);i(t,!1),requestAnimationFrame(o)}()}};e.a={name:"Picker",componentName:"Picker",components:{RemToPx:r.a},props:{options:{type:Array,reqiured:!0},value:{type:String},placeholder:{type:String,default:""},itemHeight:{type:Number,default:.9}},watch:{options:function(t){requestAnimationFrame(this.scrollToActive)}},created:function(){this.$$touch={}},mounted:function(){this.$$touch.scrollElement=this.$el.querySelector(".vx-picker"),requestAnimationFrame(this.scrollToActive),this.$nextTick(this.computeStyles),window.addEventListener("resize",this.computeStyles,!1)},beforeDestroy:function(){this.$$touch=null,this.$$pullTimer&&clearTimeout(this.$$pullTimer),this.$$timer&&clearTimeout(this.$$timer),window.removeEventListener("resize",this.computeStyles)},methods:{computeStyles:function(){var t=this,e=document.documentElement.style.fontSize;if(e&&this.itemHeight){e=parseInt(e,10);var n=e*this.itemHeight;n%2&&n++;var i=this.$el.querySelector(".vx-picker"),o=this.$el.querySelector(".vx-picker--scroller"),r=this.$el.querySelector(".vx-picker--indicator-top"),a=this.$el.querySelector(".vx-picker--indicator-bottom");requestAnimationFrame(function(){i.style.height=7*n+"px",o.style.padding=3*n+"px 0",o.style.lineHeight=n+"px",r.style.top=3*n+"px",a.style.top=4*n+"px",r.style.boxShadow="0px -"+3*n+"px 0px "+3*n+"px rgba(255,255,255,0.45)",a.style.boxShadow="0px "+3*n+"px 0px "+3*n+"px rgba(255,255,255,0.45)",requestAnimationFrame(t.scrollToActive)})}},scrollToActive:function(){var t=this,e=this.$el.querySelector(".is-active"),n=0;o()(this.$el.querySelectorAll(".vx-picker--item")).forEach(function(t,i){t===e&&(n=i)}),requestAnimationFrame(function(){t.$$touch.scrollElement.scrollTop=e?n*e.offsetHeight:0})},handleTouchEnd:function(){this.$$touch.scrollEnd=!0,this.computedScrollTop()},handleTouchMove:function(t){var e=this,n=t.changedTouches[0].pageY;this.$$touch.pageY&&(0===this.$$touch.scrollElement.scrollTop&&n-this.$$touch.pageY>0?(this.$$pullTimer&&clearTimeout(this.$$pullTimer),this.$$pullTimer=setTimeout(function(){e.$emit("pulldown")},500),t.preventDefault(),t.stopPropagation()):Math.round(this.$$touch.scrollElement.scrollTop)===this.$$touch.maxScrollTop&&n-this.$$touch.pageY<0&&(this.$$pullTimer&&clearTimeout(this.$$pullTimer),this.$$pullTimer=setTimeout(function(){e.$emit("pullup")},500),t.preventDefault(),t.stopPropagation())),this.$$touch.pageY=n},handleTouchStart:function(t){this.$$touch.scrollEnd=!1,this.$$touch.maxScrollTop=this.$$touch.scrollElement.scrollHeight-this.$$touch.scrollElement.offsetHeight,this.$$touch.pageY=t.changedTouches[0].pageY,this.$$timer&&clearTimeout(this.$$timer),this.$$pullTimer&&clearTimeout(this.$$pullTimer);var e=this.$$touch.scrollElement.querySelector(".vx-picker--item");e&&(this.$$touch.offsetHeight=e.offsetHeight)},handleScroll:function(){this.$$touch&&this.$$touch.scrollEnd&&this.computedScrollTop()},computedScrollTop:function(){var t=this;this.$$timer&&clearTimeout(this.$$timer),this.$$timer=setTimeout(function(){t.$$touch.scrollEnd=!1;var e=t.$el.querySelector(".vx-picker"),n=e.scrollTop,i=Math.round(n/t.$$touch.offsetHeight),o=i*t.$$touch.offsetHeight;requestAnimationFrame(function(){n!==o&&a(n,o,4,function(t){e.scrollTop=t});var r=t.$el.querySelectorAll(".vx-picker--item")[i];if(r){var s=r.dataset.value;s!==t.value&&t.$emit("input",s).$emit("change",s)}})},200)}}}},28:function(t,e,n){"use strict";e.a={name:"RemToPx",componentName:"RemToPx",props:{width:{type:Number},height:{type:Number},even:{type:Boolean,default:!1},tag:{type:String,default:"div"}},data:function(){return{styles:this.getStyles()}},mounted:function(){window.addEventListener("resize",this.handleResize,!1)},beforeDestroy:function(){window.removeEventListener("resize",this.handleResize)},methods:{handleResize:function(){this.styles=this.getStyles()},getStyles:function(){var t=document.documentElement.style.fontSize,e="",n="";return t&&(t=parseInt(t,10),this.width&&(e=Math.round(t*this.width),this.even&&e%2&&e++),this.height&&(n=Math.round(t*this.height),this.even&&n%2&&n++)),"width:"+e+"px;height:"+n+"px"}}}},3:function(t,e,n){"use strict";e.a={name:"Arrow",componentName:"Arrow",functional:!0,props:{direction:{type:String,default:"right"},size:{type:String,default:"0.18rem"},color:{type:String,default:"rgba(153, 153, 153, 0.6)"},tag:{type:String,default:"i"}}}},312:function(t,e,n){t.exports=n(63)},34:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(27),o=n(48),r=n(0),a=r(i.a,o.a,!1,null,null,null);e.default=a.exports},4:function(t,e,n){"use strict";var i=n(3),o=n(9),r=n(0),a=r(i.a,o.a,!0,null,null,null);e.a=a.exports},46:function(t,e,n){"use strict";var i=n(28),o=n(47),r=n(0),a=r(i.a,o.a,!1,null,null,null);e.a=a.exports},47:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement;return(t._self._c||e)(t.tag,{tag:"component",style:t.styles},[t._t("default")],2)},o=[],r={render:i,staticRenderFns:o};e.a=r},48:function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vx-picker--wrapper",attrs:{onselectstart:"return false;"}},[n("div",{staticClass:"vx-picker",on:{touchstart:t.handleTouchStart,touchmove:t.handleTouchMove,touchend:t.handleTouchEnd,scroll:t.handleScroll}},[n("div",{staticClass:"vx-picker--scroller"},[t.placeholder?n("rem-to-px",{class:["vx-picker--item","vx-picker--placeholder"],attrs:{height:t.itemHeight,even:""}},[t._v("\n "+t._s(t.placeholder)+"\n ")]):t._e(),t._l(t.options,function(e,i){return n("rem-to-px",{key:i,class:["vx-picker--item",{"is-active":e.value===t.value}],attrs:{height:t.itemHeight,even:"","data-value":e.value,"data-index":i},domProps:{innerHTML:t._s(e.label)}})})],2)]),t._m(0)])},o=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vx-picker--indicator"},[n("div",{staticClass:"vx-picker--indicator-top"}),n("div",{staticClass:"vx-picker--indicator-bottom"})])}],r={render:i,staticRenderFns:o};e.a=r},54:function(t,e,n){"use strict";var i=n(106),o=n.n(i),r=n(12),a=n(34),s=new Date;e.a={name:"DatetimePicker",componentName:"DatetimePicker",components:{Popup:r.default,Picker:a.default},props:{open:{type:Boolean,default:!1},history:{type:Boolean,default:!0},min:{type:String,default:"1900-01-01"},max:{type:String,default:s.getFullYear()+20+"-01-01"},value:{type:String,default:s.getFullYear()+"-"+(s.getMonth()+1)+"-"+s.getDate()+" "+s.getHours()+": "+s.getMinutes()+": "+s.getSeconds()},format:{type:String,default:"yyyy-MM-dd"},locale:{type:Object,default:function(){return{year:"年",month:"月",date:"日",hour:"时",minute:"分",second:"秒"}}},cancelText:{type:String,default:"取消"},confirmText:{type:String,default:"完成"},todayText:{type:String,default:"当前"}},mounted:function(){this.open&&this.initial()},watch:{open:function(t){this.initial()}},data:function(){return{pickers:[]}},methods:{parseValue:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.value;/[-\/]/.test(t)||"yyyy"===this.format||(t="1900/01/0"+t);var e=new Date(t.replace(/-/g,"/"));return{year:e.getFullYear(),month:e.getMonth()+1,date:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds()}},initial:function(){var t=this.parseValue(),e=this.getYears(),n=this.getMonths(),i=this.getDates(),o=this.getHours(),r=this.getMinutes(),a=this.getSeconds(),s=[];this.format.indexOf("yyyy")>-1&&s.push({options:e,value:String(t.year),type:"yyyy"}),this.format.indexOf("MM")>-1&&s.push({options:n,value:String(t.month),type:"MM"}),this.format.indexOf("dd")>-1&&s.push({options:i,value:String(t.date),type:"dd"}),this.format.indexOf("HH")>-1&&s.push({options:o,value:String(t.hour),type:"HH"}),this.format.indexOf("mm")>-1&&s.push({options:r,value:String(t.minute),type:"mm"}),this.format.indexOf("ss")>-1&&s.push({options:a,value:String(t.second),type:"ss"}),this.pickers=s},getYears:function(){for(var t=[],e=new Date(this.min).getFullYear(),n=new Date(this.max).getFullYear(),i=e;i<=n;i++)t.push({label:i+this.locale.year,value:String(i)});return t},getMonths:function(){for(var t=[],e=1;e<=12;e++)t.push({label:(e<10?"0"+String(e):String(e))+this.locale.month,value:String(e)});return t},getDates:function(){var t=this.parseValue(),e=t.year,n=t.month;this.pickers.forEach(function(t){"yyyy"===t.type&&t.value&&(e=parseInt(t.value,10)),"MM"===t.type&&t.value&&(n=parseInt(t.value,10))});for(var i=new Date(e,n,0),o=[],r=1;r<=i.getDate();r++)o.push({label:(r<10?"0"+String(r):String(r))+this.locale.date,value:String(r)});return o},getHours:function(){for(var t=[],e=0;e<24;e++)t.push({label:(e<10?"0"+String(e):String(e))+this.locale.hour,value:String(e)});return t},getMinutes:function(){for(var t=[],e=0;e<60;e++)t.push({label:(e<10?"0"+String(e):String(e))+this.locale.minute,value:String(e)});return t},getSeconds:function(){for(var t=[],e=0;e<60;e++)t.push({label:(e<10?"0"+String(e):String(e))+this.locale.second,value:String(e)});return t},handleClose:function(){this.$emit("update:open",!1).$emit("close")},handleConfirm:function(){var t=this.format,e=!0,n=!1,i=void 0;try{for(var r,a=o()(this.pickers);!(e=(r=a.next()).done);e=!0){var s=r.value;t=t.replace(s.type,s.value>=10?s.value:"0"+s.value)}}catch(t){n=!0,i=t}finally{try{!e&&a.return&&a.return()}finally{if(n)throw i}}this.open&&this.$emit("update:open",!1).$emit("input",t).$emit("change",t),this.handleClose()},handleChange:function(t,e,n){var i=this;if(this.pickers[e].value=t,"MM"===n||"yyyy"===n){var o=null;this.pickers.forEach(function(t){if(t.type===n&&(o=i.getDates()),o&&"dd"===t.type){var e=o.some(function(e){return e.value===t.value});t.options=o,e||(t.value=t.options[t.options.length-1].value)}})}},handleToday:function(){var t={yyyy:function(){return(new Date).getFullYear()},MM:function(){return(new Date).getMonth()+1},dd:function(){return(new Date).getDate()},hh:function(){return(new Date).getHours()},mm:function(){return(new Date).getMinutes()},ss:function(){return(new Date).getSeconds()}},e=!0,n=!1,i=void 0;try{for(var r,a=o()(this.pickers);!(e=(r=a.next()).done);e=!0){var s=r.value;t[s.type]&&(s.value=String(t[s.type]()))}}catch(t){n=!0,i=t}finally{try{!e&&a.return&&a.return()}finally{if(n)throw i}}}}}},63:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(54),o=n(107),r=n(0),a=r(i.a,o.a,!1,null,null,null);e.default=a.exports},8:function(t,e,n){"use strict";e.a={name:"Overlay",componentName:"Overlay",props:{opacity:{type:Number},open:{type:Boolean}}}},9:function(t,e,n){"use strict";var i=function(t,e){return(0,e._c)(e.props.tag,e._g(e._b({tag:"component",class:["vx-arrow",e.data.staticClass,e.data.class],style:[Object.assign({display:"inline-block",borderWidth:"1px",borderStyle:"solid",verticalAlign:"middle",boxSizing:"border-box",transform:"rotate(45deg)",height:e.props.size,width:e.props.size,borderColor:{up:e.props.color+" transparent transparent "+e.props.color,right:e.props.color+" "+e.props.color+" transparent transparent",down:"transparent "+e.props.color+" "+e.props.color+" transparent",left:"transparent transparent "+e.props.color+" "+e.props.color}[e.props.direction]},e.data.style)]},"component",e.data.attrs,!1),e.listeners))},o=[],r={render:i,staticRenderFns:o};e.a=r}});
\No newline at end of file