react-mobile-calendar
Advanced tools
Comparing version 1.0.7 to 1.0.8
108
index.js
@@ -51,23 +51,27 @@ /** | ||
for (var value of rangeDays) { | ||
if(value.disable==false) { | ||
console.log(value.moment.format('YYYY-MM-DD')+'不可以订'); | ||
return false; | ||
} | ||
} | ||
return false; | ||
if(is_complete){ | ||
console.log('选择完毕'); | ||
}else{ | ||
console.log('选择退房时间') | ||
} | ||
return true; | ||
// console.log(rangeDays); | ||
// | ||
// // for (var value of rangeDays) { | ||
// // | ||
// // if(value.disable==false) { | ||
// // | ||
// // console.log(value.moment.format('YYYY-MM-DD')+'不可以订'); | ||
// // | ||
// // return false; | ||
// // } | ||
// // } | ||
// | ||
// if(is_complete){ | ||
// | ||
// console.log('选择完毕'); | ||
// | ||
// }else{ | ||
// | ||
// console.log('选择退房时间') | ||
// | ||
// } | ||
// | ||
// return true; | ||
}; | ||
@@ -85,42 +89,42 @@ | ||
console.log(day); | ||
let day_my; | ||
days.forEach(function (value,index) { | ||
if(value.key==day.number){ | ||
return day_my; | ||
} | ||
}); | ||
// let day_my = days.find((value)=>{ | ||
// return value.key==day.number | ||
// let day_my; | ||
// | ||
// days.forEach(function (value,index) { | ||
// | ||
// if(value.key==day.number){ | ||
// return day_my; | ||
// } | ||
// }); | ||
// | ||
// // let day_my = days.find((value)=>{ | ||
// // return value.key==day.number | ||
// // }); | ||
// | ||
// if(day_my==undefined){ | ||
// | ||
// day.disable = true; | ||
// | ||
// day.money = '暂无'; | ||
// | ||
// props.className += ' disable'; | ||
// | ||
// | ||
// }else{ | ||
// | ||
// day.money = day_my.text; | ||
// | ||
// day.disable = false; | ||
// | ||
// | ||
// } | ||
{/*props.children = <div className="day"><span className="textNum">{day.text}</span><span className="textMoney">{day.money}</span></div>;*/} | ||
if(day_my==undefined){ | ||
day.disable = false; | ||
day.money = '暂无'; | ||
}else{ | ||
day.money = day_my.text; | ||
day.disable = true; | ||
} | ||
props.children = <div className="day"><span className="textNum">{day.text}</span><span className="textMoney">{day.money}</span></div>; | ||
}; | ||
ReactDOM.render( | ||
<div> | ||
<DatePicker defaultDay="2016-12-03" onDayClick={onDateDayClick} /> | ||
<MultiMonthView isShowWeek="true" startMoment="2016-12-03" endMoment="2016-12-06" startText="入住" endText="退房" monthNumber="5" viewMoment="2016-12" onDayClick={onDayClick} rendDay={rendDay}/> | ||
<MultiMonthView isShowWeek="true" startText="入住" endText="退房" monthNumber="2" onDayClick={onDayClick} rendDay={rendDay}/> | ||
</div>, | ||
document.getElementById('root') | ||
); |
@@ -39,2 +39,4 @@ 'use strict'; | ||
var _lang = require('lodash/lang'); | ||
var _toMoment = require('../Utils/toMoment'); | ||
@@ -58,5 +60,2 @@ | ||
/** | ||
* Created by zhouchao on 16/12/9. | ||
*/ | ||
var getMonthDays = function getMonthDays(viewMoment, monthNumber) { | ||
@@ -88,4 +87,7 @@ | ||
return monthDays; | ||
}; | ||
}; /** | ||
* Created by zhouchao on 16/12/9. | ||
*/ | ||
var getDaysInMonthView = function getDaysInMonthView(start, end) { | ||
@@ -208,2 +210,4 @@ | ||
var days = (0, _lang.cloneDeep)(this.state.monthDays[monthIndex]['days']); | ||
var dayMoment = (0, _toMoment2.default)(day.moment); | ||
@@ -237,2 +241,4 @@ | ||
var monthDays = this.state.monthDays; | ||
var rangeDays = []; | ||
@@ -244,2 +250,4 @@ | ||
console.log(this.state.monthDays); | ||
if (this.props.onDayClick(day, rangeDays, is_complete)) { | ||
@@ -250,5 +258,7 @@ | ||
this.startMoment = startMoment; | ||
this.state.monthDays[monthIndex]['days'] = days; | ||
this.endMoment = endMoment; | ||
// this.startMoment = startMoment; | ||
// | ||
// this.endMoment = endMoment; | ||
} | ||
@@ -359,2 +369,12 @@ } | ||
}, { | ||
key: 'arrayCopy', | ||
value: function arrayCopy(arr) { | ||
var newArr = []; | ||
for (var i = 0; i < arr.length; i++) { | ||
newArr.push(this.arrayCopy(arr[i])); | ||
} | ||
return newArr; | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -361,0 +381,0 @@ value: function render() { |
{ | ||
"name": "react-mobile-calendar", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "> 用react做的用于手机端显示的日历", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,2 +6,3 @@ /** | ||
import chunk from 'lodash/chunk' | ||
import { cloneDeep } from 'lodash/lang' | ||
import toMoment from '../Utils/toMoment' | ||
@@ -163,3 +164,5 @@ import format from '../Utils/format' | ||
let day = this.state.monthDays[monthIndex]['days'][dayIndex]; | ||
var days = cloneDeep(this.state.monthDays[monthIndex]['days']); | ||
let dayMoment = toMoment(day.moment); | ||
@@ -196,2 +199,4 @@ | ||
} | ||
var monthDays = this.state.monthDays; | ||
@@ -202,5 +207,6 @@ | ||
rangeDays = this.doMap(rangeDays); | ||
let is_complete = this.startMoment != null && this.endMoment != null; | ||
console.log(this.state.monthDays); | ||
@@ -212,7 +218,9 @@ if (this.props.onDayClick(day, rangeDays, is_complete)){ | ||
}else{ | ||
this.state.monthDays[monthIndex]['days'] = days; | ||
this.startMoment = startMoment; | ||
// this.startMoment = startMoment; | ||
// | ||
// this.endMoment = endMoment; | ||
this.endMoment = endMoment; | ||
} | ||
@@ -272,2 +280,4 @@ } | ||
this.props.rendDay(day,props); | ||
@@ -311,4 +321,17 @@ return <div onClick={()=>this.onDayClick(dayIndex,monthIndex)} {...props} ></div> | ||
arrayCopy(arr){ | ||
var newArr = []; | ||
for (var i=0; i<arr.length; i++) { | ||
newArr.push(this.arrayCopy(arr[i])); | ||
} | ||
return newArr; | ||
} | ||
render(){ | ||
return ( | ||
@@ -315,0 +338,0 @@ <div className="rmc-days"> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
210523
1269