u-calendar.js 8.2 KB

12345678910
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uni_modules/vk-uview-ui/components/u-calendar/u-calendar"],{"0fbd":function(t,e,a){"use strict";a.r(e);var n=a("3e82"),i=a.n(n);for(var r in n)["default"].indexOf(r)<0&&function(t){a.d(e,t,(function(){return n[t]}))}(r);e["default"]=i.a},"3a4d":function(t,e,a){},"3e82":function(t,e,a){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a={name:"u-calendar",emits:["update:modelValue","input","change"],props:{value:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},safeAreaInsetBottom:{type:Boolean,default:!1},maskCloseAble:{type:Boolean,default:!0},zIndex:{type:[String,Number],default:0},changeYear:{type:Boolean,default:!0},changeMonth:{type:Boolean,default:!0},mode:{type:String,default:"date"},maxYear:{type:[Number,String],default:2050},minYear:{type:[Number,String],default:1950},minDate:{type:[Number,String],default:"1950-01-01"},maxDate:{type:[Number,String],default:""},borderRadius:{type:[String,Number],default:20},monthArrowColor:{type:String,default:"#606266"},yearArrowColor:{type:String,default:"#909399"},color:{type:String,default:"#303133"},activeBgColor:{type:String,default:"#2979ff"},activeColor:{type:String,default:"#ffffff"},rangeBgColor:{type:String,default:"rgba(41,121,255,0.13)"},rangeColor:{type:String,default:"#2979ff"},startText:{type:String,default:"开始"},endText:{type:String,default:"结束"},btnType:{type:String,default:"primary"},isActiveCurrent:{type:Boolean,default:!0},isChange:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},toolTip:{type:String,default:"选择日期"},blur:{type:[Number,String],default:0}},data:function(){return{popupValue:!1,weekday:1,weekdayArr:[],days:0,daysArr:[],showTitle:"",year:2020,month:0,day:0,startYear:0,startMonth:0,startDay:0,endYear:0,endMonth:0,endDay:0,today:"",activeDate:"",startDate:"",endDate:"",isStart:!0,min:null,max:null,weekDayZh:["日","一","二","三","四","五","六"]}},computed:{valueCom:function(){return this.value},dataChange:function(){return"".concat(this.mode,"-").concat(this.minDate,"-").concat(this.maxDate)},uZIndex:function(){return this.zIndex?this.zIndex:this.$u.zIndex.popup}},watch:{dataChange:function(t){this.init()},valueCom:{immediate:!0,handler:function(t){this.popupValue=t}}},created:function(){this.init()},methods:{getColor:function(t,e){var a=1==e?"":this.color,n=t+1,i="".concat(this.year,"-").concat(this.month,"-").concat(n),r=new Date(i.replace(/\-/g,"/")).getTime(),s=this.startDate.replace(/\-/g,"/"),o=this.endDate.replace(/\-/g,"/");return this.isActiveCurrent&&this.activeDate==i||this.startDate==i||this.endDate==i?a=1==e?this.activeBgColor:this.activeColor:this.endDate&&r>new Date(s).getTime()&&r<new Date(o).getTime()&&(a=1==e?this.rangeBgColor:this.rangeColor),a},init:function(){var t=new Date;this.year=t.getFullYear(),this.month=t.getMonth()+1,this.day=t.getDate(),this.today="".concat(t.getFullYear(),"-").concat(t.getMonth()+1,"-").concat(t.getDate()),this.activeDate=this.today,this.min=this.initDate(this.minDate),this.max=this.initDate(this.maxDate||this.today),this.startDate="",this.startYear=0,this.startMonth=0,this.startDay=0,this.endYear=0,this.endMonth=0,this.endDay=0,this.endDate="",this.isStart=!0,this.changeData()},initDate:function(t){var e=t.split("-");return{year:Number(e[0]||1920),month:Number(e[1]||1),day:Number(e[2]||1)}},openDisAbled:function(t,e,a){var n=!0,i="".concat(t,"/").concat(e,"/").concat(a),r="".concat(this.min.year,"/").concat(this.min.month,"/").concat(this.min.day),s="".concat(this.max.year,"/").concat(this.max.month,"/").concat(this.max.day),o=new Date(i).getTime();return o>=new Date(r).getTime()&&o<=new Date(s).getTime()&&(n=!1),n},generateArray:function(t,e){return Array.from(new Array(e+1).keys()).slice(t)},formatNum:function(t){return t<10?"0"+t:t+""},getMonthDay:function(t,e){var a=new Date(t,e,0).getDate();return a},getWeekday:function(t,e){var a=new Date("".concat(t,"/").concat(e,"/01 00:00:00"));return a.getDay()},checkRange:function(e){var a=!1;return(e<this.minYear||e>this.maxYear)&&(t.showToast({title:"日期超出范围啦~",icon:"none"}),a=!0),a},changeMonthHandler:function(t){if(t){var e=this.month+1,a=e>12?this.year+1:this.year;this.checkRange(a)||(this.month=e>12?1:e,this.year=a,this.changeData())}else{var n=this.month-1,i=n<1?this.year-1:this.year;this.checkRange(i)||(this.month=n<1?12:n,this.year=i,this.changeData())}},changeYearHandler:function(t){var e=t?this.year+1:this.year-1;this.checkRange(e)||(this.year=e,this.changeData())},changeData:function(){this.days=this.getMonthDay(this.year,this.month),this.daysArr=this.generateArray(1,this.days),this.weekday=this.getWeekday(this.year,this.month),this.weekdayArr=this.generateArray(1,this.weekday),this.showTitle="".concat(this.year,"年").concat(this.month,"月"),this.isChange&&"date"==this.mode&&this.btnFix(!0)},dateClick:function(t){if(t+=1,!this.openDisAbled(this.year,this.month,t)){this.day=t;var e="".concat(this.year,"-").concat(this.month,"-").concat(t);if("date"==this.mode)this.activeDate=e;else{var a=new Date(e.replace(/\-/g,"/")).getTime()<new Date(this.startDate.replace(/\-/g,"/")).getTime();this.isStart||a?(this.startDate=e,this.startYear=this.year,this.startMonth=this.month,this.startDay=this.day,this.endYear=0,this.endMonth=0,this.endDay=0,this.endDate="",this.activeDate="",this.isStart=!1):(this.endDate=e,this.endYear=this.year,this.endMonth=this.month,this.endDay=this.day,this.isStart=!0)}}},close:function(){this.$emit("input",!1),this.$emit("update:modelValue",!1)},getWeekText:function(t){t=new Date("".concat(t.replace(/\-/g,"/")," 00:00:00"));var e=t.getDay();return"星期"+["日","一","二","三","四","五","六"][e]},btnFix:function(t){if(t||this.close(),"date"==this.mode){var e=this.activeDate.split("-"),a=this.isChange?this.year:Number(e[0]),n=this.isChange?this.month:Number(e[1]),i=this.isChange?this.day:Number(e[2]),r=this.getMonthDay(a,n),s="".concat(a,"-").concat(this.formatNum(n),"-").concat(this.formatNum(i)),o=this.getWeekText(s),h=!1;"".concat(a,"-").concat(n,"-").concat(i)==this.today&&(h=!0),this.$emit("change",{year:a,month:n,day:i,days:r,result:s,week:o,isToday:h})}else{if(!this.startDate||!this.endDate)return;var c=this.formatNum(this.startMonth),u=this.formatNum(this.startDay),d="".concat(this.startYear,"-").concat(c,"-").concat(u),l=this.getWeekText(d),m=this.formatNum(this.endMonth),f=this.formatNum(this.endDay),y="".concat(this.endYear,"-").concat(m,"-").concat(f),g=this.getWeekText(y);this.$emit("change",{startYear:this.startYear,startMonth:this.startMonth,startDay:this.startDay,startDate:d,startWeek:l,endYear:this.endYear,endMonth:this.endMonth,endDay:this.endDay,endDate:y,endWeek:g})}}}};e.default=a}).call(this,a("543d")["default"])},"51c3":function(t,e,a){"use strict";var n=a("3a4d"),i=a.n(n);i.a},6028:function(t,e,a){"use strict";a.r(e);var n=a("980e"),i=a("0fbd");for(var r in i)["default"].indexOf(r)<0&&function(t){a.d(e,t,(function(){return i[t]}))}(r);a("51c3");var s=a("f0c5"),o=Object(s["a"])(i["default"],n["b"],n["c"],!1,null,"cb5294f0",null,!1,n["a"],void 0);e["default"]=o.exports},"980e":function(t,e,a){"use strict";a.d(e,"b",(function(){return i})),a.d(e,"c",(function(){return r})),a.d(e,"a",(function(){return n}));var n={uPopup:function(){return a.e("uni_modules/vk-uview-ui/components/u-popup/u-popup").then(a.bind(null,"7401"))},uIcon:function(){return a.e("uni_modules/vk-uview-ui/components/u-icon/u-icon").then(a.bind(null,"ccaa"))},uButton:function(){return a.e("uni_modules/vk-uview-ui/components/u-button/u-button").then(a.bind(null,"51b1b"))}},i=function(){var t=this,e=t.$createElement,a=(t._self._c,t.__map(t.daysArr,(function(e,a){var n=t.__get_orig(e),i=t.openDisAbled(t.year,t.month,a+1),r=t.getColor(a,1),s=t.getColor(a,2);return{$orig:n,m0:i,m1:r,m2:s}})));t.$mp.data=Object.assign({},{$root:{l0:a}})},r=[]}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'uni_modules/vk-uview-ui/components/u-calendar/u-calendar-create-component',
  4. {
  5. 'uni_modules/vk-uview-ui/components/u-calendar/u-calendar-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('543d')['createComponent'](__webpack_require__("6028"))
  7. })
  8. },
  9. [['uni_modules/vk-uview-ui/components/u-calendar/u-calendar-create-component']]
  10. ]);