UNPKG

11 kBJavaScriptView Raw
1module.exports=function(e){function t(n){if(a[n])return a[n].exports;var r=a[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var a={};return t.m=e,t.c=a,t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=315)}({0:function(e,t){e.exports=function(e,t,a,n,r,i){var s,l=e=e||{},o=typeof e.default;"object"!==o&&"function"!==o||(s=e,l=e.default);var u="function"==typeof l?l.options:l;t&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0),a&&(u.functional=!0),r&&(u._scopeId=r);var c;if(i?(c=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__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},u._ssrRegister=c):n&&(c=n),c){var d=u.functional,h=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(e,t){return c.call(t),h(e,t)}):u.beforeCreate=h?[].concat(h,c):[c]}return{esModule:s,exports:l,options:u}}},13:function(e,t,a){"use strict";var n=a(6),r=a(14),i=a(0),s=i(n.a,r.a,!1,null,null,null);t.a=s.exports},14:function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement;return(e._self._c||t)(e.tag,{tag:"component",class:e.classes},[e._t("default")],2)},r=[],i={render:n,staticRenderFns:r};t.a=i},15:function(e,t,a){"use strict";var n=a(7),r=a(16),i=a(0),s=i(n.a,r.a,!1,null,null,null);t.a=s.exports},16:function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement;return(e._self._c||t)(e.tag,{tag:"component",staticClass:"vx-flexbox--item",style:e.styles},[e._t("default")],2)},r=[],i={render:n,staticRenderFns:r};t.a=i},2:function(e,t){e.exports=require("babel-runtime/helpers/extends")},29:function(e,t,a){"use strict";var n=a(2),r=a.n(n),i=a(5),s=a(4);t.a={name:"Calendar",componentName:"Calendar",components:{Flexbox:i.Flexbox,FlexboxItem:i.FlexboxItem,Arrow:s.a},props:{value:{type:[Date,Array,String]},weekText:{type:Object,default:function(){return{EN:["Sun","Mon","Tues","Wed","Thurs","Fri","Satur"],ZH:["一","二","三","四","五","六","日"]}}},yearText:{type:Object,default:function(){return{EN:" Year",ZH:"年"}}},monthText:{type:Object,default:function(){return{EN:" Month",ZH:"月"}}},isRange:{type:Boolean,default:!1},layout:{type:Array,default:function(){return["year","month","week","date"]}},lang:{type:String,default:"ZH"},isWeekRange:{type:Boolean,default:!1}},computed:{myWeekText:function(){return this.weekText[this.lang]},dateList:function(){return this.getCalendarItems()}},watch:{value:function(e){this.myValue=e}},data:function(){var e=this.getYMD();return this.isRange?this.value&&this.value[0]&&(e=this.getYMD(this.value[0]||this.value[1])):e=this.value?this.getYMD(this.value):this.getYMD(),{myValue:this.value,date:e,datetimes:864e5}},methods:{handleYearChange:function(e){var t=new Date(this.date.getTime());t.setFullYear(t.getFullYear()+e),this.date=t,this.$emit("date-change",t)},handleYearChange2:function(e){var t=new Date(this.date.getTime());t.setFullYear(Number(e.target.value)),this.date=t,this.$emit("date-change",t)},handleMonthChange:function(e){var t=new Date(this.date.getTime());t.setMonth(t.getMonth()+e),this.date=t,this.$emit("date-change",t)},handleMonthChange2:function(e){var t=new Date(this.date.getTime());t.setMonth(Number(e.target.value)-1),this.date=t,this.$emit("date-change",t)},calendarClasses:function(e){var t=[];return t.push("vx-calendar--date"),e.weekend&&t.push("is-weekend"),e.today&&t.push("is-today"),!e.currentMonth&&t.push("is-disabled"),this.isRange?(e.start&&t.push("is-start"),e.end&&t.push("is-end"),e.active&&t.push("is-active")):e.active&&t.push("is-start"),t},getLastDate:function(e,t){return 11===t?(e++,t=0):t++,new Date(e,t,0)},getYMD:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},getDateCalendarStatus:function(e){return this.isRange?{start:!(!this.myValue||!this.myValue[0]||this.myValue[0].getTime()!==e.getTime()),end:!(!this.myValue||!this.myValue[1]||this.myValue[1].getTime()!==e.getTime()),active:!!(this.myValue&&this.myValue[0]&&this.myValue&&this.myValue[1]&&e.getTime()>this.myValue[0].getTime()&&e.getTime()<this.myValue[1].getTime())}:{active:this.myValue&&this.getYMD(this.myValue).getTime()===e.getTime()}},getCalendarItems:function(){var e=[],t=this.date.getFullYear(),a=this.date.getMonth(),n=this.getLastDate(t,a),i=new Date(t,a,1),s=i.getDay(),l=this.getYMD(),o="ZH"===this.lang?1:0,u="ZH"===this.lang?0:6;if(s!==o)for(var c=1;c<7;c++){var d=new Date(i.getTime()-this.datetimes*c);if(e.unshift(r()({},this.getDateCalendarStatus(d),{today:d.getTime()===l.getTime(),currentMonth:!1,value:d,weekend:[0,6].indexOf(d.getDay())>-1})),d.getDay()===o)break}for(var h=1;h<=n.getDate();h++){var f=new Date(t,a,h);e.push(r()({},this.getDateCalendarStatus(f),{today:f.getTime()===l.getTime(),currentMonth:!0,value:f,weekend:[0,6].indexOf(f.getDay())>-1}))}if(e[e.length-1].value.getDay()!==u)for(var g=1;g<=7;g++){var p=new Date(n.getTime()+this.datetimes*g);if(e.push(r()({},this.getDateCalendarStatus(p),{today:p.getTime()===l.getTime(),currentMonth:!1,value:p,weekend:[0,6].indexOf(p.getDay())>-1})),p.getDay()===u)break}return e},setValue:function(e){this.myValue=e,this.$emit("input",e).$emit("change",e)},handleChange:function(e){this.isRange?this.isWeekRange?this.setValue([this.dateList[7*Math.floor(e/7)].value,this.dateList[7*(Math.floor(e/7)+1)-1].value]):e instanceof Array?this.setValue(e):(!this.myValue[0]&&!this.myValue[1]||this.myValue[0]&&this.myValue[1]?this.myValue=[e]:this.myValue=this.myValue[0]>e?[]:[this.myValue[0],e],2===this.myValue.length&&this.setValue(this.myValue)):this.setValue(e)}}}},3:function(e,t,a){"use strict";t.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"}}}},315:function(e,t,a){e.exports=a(37)},37:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(29),r=a(49),i=a(0),s=i(n.a,r.a,!1,null,null,null);t.default=s.exports},4:function(e,t,a){"use strict";var n=a(3),r=a(9),i=a(0),s=i(n.a,r.a,!0,null,null,null);t.a=s.exports},49:function(e,t,a){"use strict";var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"vx-calendar--wrapper"},[a("div",{staticClass:"vx-calendar--header"},[e.layout.indexOf("year")>-1||e.layout.indexOf("month")>-1?a("flexbox",{staticClass:"vx-calendar--controls"},[e.layout.indexOf("year")>-1?a("flexbox-item",[a("flexbox",{attrs:{align:"center"}},[a("button",{class:{"is-disabled":e.date.getFullYear()<=1990},attrs:{type:"button"},on:{click:function(t){e.handleYearChange(-1)}}},[a("arrow",{attrs:{direction:"left",size:"0.22rem"}})],1),a("flexbox-item",[e._v("\n "+e._s(e.date.getFullYear())+e._s(e.yearText[e.lang])+"\n "),a("input",{attrs:{type:"number",min:1990,max:e.date.getFullYear()+100},domProps:{value:e.date.getFullYear()},on:{change:e.handleYearChange2}})]),a("button",{attrs:{type:"button"},on:{click:function(t){e.handleYearChange(1)}}},[a("arrow",{attrs:{size:"0.22rem"}})],1)],1)],1):e._e(),e.layout.indexOf("month")>-1?a("flexbox-item",[a("flexbox",{attrs:{align:"center"}},[a("button",{class:{"is-disabled":0===e.date.getMonth()},attrs:{type:"button"},on:{click:function(t){e.handleMonthChange(-1)}}},[a("arrow",{attrs:{direction:"left",size:"0.22rem"}})],1),a("flexbox-item",[e._v("\n "+e._s(e.date.getMonth()+1)+e._s(e.monthText[e.lang])+"\n "),a("input",{attrs:{type:"number",min:1,max:"12"},domProps:{value:e.date.getMonth()+1},on:{change:e.handleMonthChange2}})]),a("button",{class:{"is-disabled":11===e.date.getMonth()},attrs:{type:"button"},on:{click:function(t){e.handleMonthChange(1)}}},[a("arrow",{attrs:{size:"0.22rem"}})],1)],1)],1):e._e()],1):e._e(),e.layout.indexOf("week")>-1?a("flexbox",e._l(e.myWeekText,function(t,n){return a("flexbox-item",{key:n,class:[("ZH"==e.lang?5==n:0==n)||6==n?"is-weekend":""]},[e._v(e._s(t))])}),1):e._e()],1),e.layout.indexOf("date")>-1?a("flexbox",{staticClass:"vx-calendar"},e._l(e.dateList,function(t,n){return a("div",{key:t.value.getTime(),class:e.calendarClasses(t),on:{click:function(a){e.handleChange(e.isWeekRange?n:t.value)}}},[e.$slots.default?e._t("default",null,null,t):a("span",{staticClass:"vx-calendar--date-text"},[e._v(e._s(t.value.getDate()))])],2)})):e._e()],1)},r=[],i={render:n,staticRenderFns:r};t.a=i},5:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(13),r=a(15);a.d(t,"Flexbox",function(){return n.a}),a.d(t,"FlexboxItem",function(){return r.a})},6:function(e,t,a){"use strict";var n={direction:{column:"flexbox--column"},wrap:{wrap:"flexbox--wrap"},justify:{center:"flexbox--content-center"},align:{center:"flexbox--align-center"}};t.a={name:"Flexbox",componentName:"Flexbox",props:{direction:{type:String,default:"normal"},wrap:{type:String,default:"normal"},justify:{type:String,default:"normal"},align:{type:String,default:"normal"},gutter:{type:Number,default:8},tag:{type:String,default:"div"}},computed:{classes:function(){var e=["vx-flexbox"];for(var t in n)this[t]&&n[t][this[t]]&&e.push("vx-"+n[t][this[t]]);return e}}}},7:function(e,t,a){"use strict";t.a={name:"FlexboxItem",componentName:"FlexboxItem",props:{flex:{type:[String,Number],default:1},order:{type:Number},tag:{type:String,default:"div"}},computed:{styles:function(){var e="number"==typeof this.$parent.gutter?this.$parent.gutter+"px":this.$parent.gutter;return"\n margin-left: "+e+";\n margin-right: "+e+";\n -ms-flex: "+this.flex+";\n -webkit-box-flex: "+this.flex+";\n -moz-box-flex: "+this.flex+";\n -webkit-flex: "+this.flex+";\n -moz-flex: "+this.flex+";\n flex: "+this.flex+";\n min-width: 0;\n order:"+this.order+"\n "}}}},9:function(e,t,a){"use strict";var n=function(e,t){return(0,t._c)(t.props.tag,t._g(t._b({tag:"component",class:["vx-arrow",t.data.staticClass,t.data.class],style:[Object.assign({display:"inline-block",borderWidth:"1px",borderStyle:"solid",verticalAlign:"middle",boxSizing:"border-box",transform:"rotate(45deg)",height:t.props.size,width:t.props.size,borderColor:{up:t.props.color+" transparent transparent "+t.props.color,right:t.props.color+" "+t.props.color+" transparent transparent",down:"transparent "+t.props.color+" "+t.props.color+" transparent",left:"transparent transparent "+t.props.color+" "+t.props.color}[t.props.direction]},t.data.style)]},"component",t.data.attrs,!1),t.listeners))},r=[],i={render:n,staticRenderFns:r};t.a=i}});
\No newline at end of file