Skip to content

Commit

Permalink
Update compiled files
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Aug 26, 2017
1 parent 408c214 commit 82e4e53
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 13 deletions.
27 changes: 23 additions & 4 deletions build/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,31 @@ var Calendar = function (_Component) {
if (value instanceof Array) {
return value;
}
return (0, _dates.getRange)(this.valueType, value);
return [this.getValueFrom(value), this.getValueTo(value)];
}
}, {
key: 'getValueFrom',
value: function getValueFrom(value) {
if (!value) {
return value;
}
var minDate = this.props.minDate;

var rawValueFrom = value instanceof Array ? value[0] : value;
return (0, _dates.getRange)(this.valueType, rawValueFrom)[0];
var valueFrom = (0, _dates.getBegin)(this.valueType, rawValueFrom);
return minDate && minDate > valueFrom ? minDate : valueFrom;
}
}, {
key: 'getValueTo',
value: function getValueTo(value) {
if (!value) {
return value;
}
var maxDate = this.props.maxDate;

var rawValueFrom = value instanceof Array ? value[1] : value;
return (0, _dates.getRange)(this.valueType, rawValueFrom)[1];
var valueTo = (0, _dates.getEnd)(this.valueType, rawValueFrom);
return maxDate && maxDate < valueTo ? maxDate : valueTo;
}

/**
Expand Down Expand Up @@ -246,7 +258,8 @@ var Calendar = function (_Component) {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;

var rangeType = this.getView(props);
return (0, _dates.getBegin)(rangeType, this.getValueFrom(props.value));
var valueFrom = this.getValueFrom(props.value) || new Date();
return (0, _dates.getBegin)(rangeType, valueFrom);
}
}, {
key: 'getView',
Expand Down Expand Up @@ -278,6 +291,8 @@ var Calendar = function (_Component) {
valueType = this.valueType;
var _props = this.props,
calendarType = _props.calendarType,
maxDate = _props.maxDate,
minDate = _props.minDate,
showWeekNumbers = _props.showWeekNumbers,
value = _props.value;
var _state = this.state,
Expand All @@ -287,6 +302,8 @@ var Calendar = function (_Component) {

var commonProps = {
activeStartDate: activeStartDate,
maxDate: maxDate,
minDate: minDate,
setView: setView,
value: value,
valueType: valueType
Expand Down Expand Up @@ -405,7 +422,9 @@ Calendar.defaultProps = {
Calendar.propTypes = {
calendarType: _propTypes3.isCalendarType,
locale: _propTypes2.default.string,
maxDate: _propTypes3.isMaxDate,
maxDetail: _propTypes2.default.oneOf(allViews),
minDate: _propTypes3.isMinDate,
minDetail: _propTypes2.default.oneOf(allViews),
next2Label: _propTypes2.default.string,
nextLabel: _propTypes2.default.string,
Expand Down
2 changes: 2 additions & 0 deletions build/CenturyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ exports.default = CenturyView;

CenturyView.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
setActiveRange: _propTypes2.default.func,
setView: _propTypes2.default.func,
Expand Down
7 changes: 7 additions & 0 deletions build/CenturyView/Decade.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var _propTypes2 = _interopRequireDefault(_propTypes);

var _dates = require('../shared/dates');

var _propTypes3 = require('../shared/propTypes');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var className = 'react-calendar__century-view__decades__decade';
Expand All @@ -23,11 +25,14 @@ var Decade = function Decade(_ref) {
date = _ref.date,
decade = _ref.decade,
hasActive = _ref.hasActive,
maxDate = _ref.maxDate,
minDate = _ref.minDate,
onChange = _ref.onChange;
return _react2.default.createElement(
'button',
{
className: [className, active ? 'react-calendar__tile--active' : '', hasActive ? 'react-calendar__tile--hasActive' : '', 'react-calendar__tile'].join(' '),
disabled: minDate && (0, _dates.getBeginOfDecade)(minDate) > date || maxDate && (0, _dates.getEndOfDecade)(maxDate) < date,
onClick: onChange && function () {
return onChange(date);
}
Expand All @@ -45,6 +50,8 @@ Decade.propTypes = {
date: _propTypes2.default.instanceOf(Date).isRequired,
decade: _propTypes2.default.number.isRequired,
hasActive: _propTypes2.default.bool.isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func
};

Expand Down
6 changes: 6 additions & 0 deletions build/CenturyView/Decades.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ var Decades = function (_Component) {
var end = this.end,
start = this.start;
var _props = this.props,
maxDate = _props.maxDate,
minDate = _props.minDate,
onChange = _props.onChange,
value = _props.value,
valueType = _props.valueType;
Expand All @@ -66,6 +68,8 @@ var Decades = function (_Component) {
date: date,
decade: decade,
key: decade,
maxDate: maxDate,
minDate: minDate,
onChange: onChange
})));
}
Expand Down Expand Up @@ -102,6 +106,8 @@ exports.default = Decades;

Decades.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
value: _propTypes3.isValue,
valueType: _propTypes2.default.string
Expand Down
2 changes: 2 additions & 0 deletions build/DecadeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ exports.default = DecadeView;

DecadeView.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
setActiveRange: _propTypes2.default.func,
setView: _propTypes2.default.func,
Expand Down
9 changes: 9 additions & 0 deletions build/DecadeView/Year.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _dates = require('../shared/dates');

var _propTypes3 = require('../shared/propTypes');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var className = 'react-calendar__decade-view__years__year';
Expand All @@ -20,12 +24,15 @@ var Year = function Year(_ref) {
var active = _ref.active,
date = _ref.date,
hasActive = _ref.hasActive,
maxDate = _ref.maxDate,
minDate = _ref.minDate,
onChange = _ref.onChange,
year = _ref.year;
return _react2.default.createElement(
'button',
{
className: [className, active ? 'react-calendar__tile--active' : '', hasActive ? 'react-calendar__tile--hasActive' : '', 'react-calendar__tile'].join(' '),
disabled: minDate && (0, _dates.getBeginOfYear)(minDate) > date || maxDate && (0, _dates.getEndOfYear)(maxDate) < date,
onClick: onChange && function () {
return onChange(date);
}
Expand All @@ -42,6 +49,8 @@ Year.propTypes = {
active: _propTypes2.default.bool.isRequired,
date: _propTypes2.default.instanceOf(Date).isRequired,
hasActive: _propTypes2.default.bool.isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
year: _propTypes2.default.number.isRequired
};
Expand Down
6 changes: 6 additions & 0 deletions build/DecadeView/Years.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ var Years = function (_Component) {
var end = this.end,
start = this.start;
var _props = this.props,
maxDate = _props.maxDate,
minDate = _props.minDate,
onChange = _props.onChange,
value = _props.value,
valueType = _props.valueType;
Expand All @@ -65,6 +67,8 @@ var Years = function (_Component) {
years.push(_react2.default.createElement(_Year2.default, _extends({}, (0, _utils.getTileActivityFlags)(value, valueType, date, 'year'), {
date: date,
key: year,
maxDate: maxDate,
minDate: minDate,
onChange: onChange,
year: year
})));
Expand Down Expand Up @@ -101,6 +105,8 @@ exports.default = Years;

Years.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
value: _propTypes3.isValue,
valueType: _propTypes2.default.string
Expand Down
2 changes: 2 additions & 0 deletions build/MonthView.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ exports.default = MonthView;
MonthView.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
calendarType: _propTypes3.isCalendarType,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
setActiveRange: _propTypes2.default.func,
setView: _propTypes2.default.func,
Expand Down
5 changes: 5 additions & 0 deletions build/MonthView/Day.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ var Day = function Day(_ref) {
var active = _ref.active,
calendarType = _ref.calendarType,
date = _ref.date,
maxDate = _ref.maxDate,
minDate = _ref.minDate,
onChange = _ref.onChange;
return _react2.default.createElement(
'button',
{
className: [className, 'react-calendar__tile', active ? 'react-calendar__tile--active' : '', (0, _dates.isWeekend)(date) ? className + '--weekend' : ''].join(' '),
disabled: minDate && (0, _dates.getBeginOfDay)(minDate) > date || maxDate && (0, _dates.getEndOfDay)(maxDate) < date,
key: date,
onClick: onChange && function () {
return onChange(date);
Expand All @@ -49,6 +52,8 @@ Day.propTypes = {
active: _propTypes2.default.bool.isRequired,
calendarType: _propTypes3.isCalendarType,
date: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func
};

Expand Down
6 changes: 6 additions & 0 deletions build/MonthView/Days.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ var Days = function (_Component) {
monthIndex = this.monthIndex;
var _props = this.props,
calendarType = _props.calendarType,
maxDate = _props.maxDate,
minDate = _props.minDate,
onChange = _props.onChange,
value = _props.value,
valueType = _props.valueType;
Expand All @@ -76,6 +78,8 @@ var Days = function (_Component) {
days.push(_react2.default.createElement(_Day2.default, _extends({}, (0, _utils.getTileActivityFlags)(value, valueType, date, 'day'), {
calendarType: calendarType,
date: date,
maxDate: maxDate,
minDate: minDate,
key: day,
onChange: onChange
})));
Expand Down Expand Up @@ -123,6 +127,8 @@ exports.default = Days;
Days.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
calendarType: _propTypes3.isCalendarType.isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
value: _propTypes3.isValue,
valueType: _propTypes2.default.string
Expand Down
2 changes: 2 additions & 0 deletions build/YearView.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ exports.default = YearView;

YearView.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
setActiveRange: _propTypes2.default.func,
setView: _propTypes2.default.func,
Expand Down
7 changes: 7 additions & 0 deletions build/YearView/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ var _propTypes2 = _interopRequireDefault(_propTypes);

var _dates = require('../shared/dates');

var _propTypes3 = require('../shared/propTypes');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var className = 'react-calendar__year-view__months__month';
Expand All @@ -22,11 +24,14 @@ var Month = function Month(_ref) {
var active = _ref.active,
date = _ref.date,
hasActive = _ref.hasActive,
maxDate = _ref.maxDate,
minDate = _ref.minDate,
onChange = _ref.onChange;
return _react2.default.createElement(
'button',
{
className: [className, active ? 'react-calendar__tile--active' : '', hasActive ? 'react-calendar__tile--hasActive' : '', 'react-calendar__tile'].join(' '),
disabled: minDate && (0, _dates.getBeginOfMonth)(minDate) > date || maxDate && (0, _dates.getEndOfMonth)(maxDate) < date,
onClick: onChange && function () {
return onChange(date);
}
Expand All @@ -43,6 +48,8 @@ Month.propTypes = {
active: _propTypes2.default.bool.isRequired,
date: _propTypes2.default.instanceOf(Date).isRequired,
hasActive: _propTypes2.default.bool.isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func
};

Expand Down
8 changes: 7 additions & 1 deletion build/YearView/Months.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ var Months = function (_Component) {
start = this.start,
year = this.year;
var _props = this.props,
maxDate = _props.maxDate,
minDate = _props.minDate,
onChange = _props.onChange,
value = _props.value,
valueType = _props.valueType;
Expand All @@ -72,8 +74,10 @@ var Months = function (_Component) {
var date = new Date(year, monthIndex, 1);

months.push(_react2.default.createElement(_Month2.default, _extends({}, (0, _utils.getTileActivityFlags)(value, valueType, date, 'month'), {
key: monthIndex,
date: date,
key: monthIndex,
maxDate: maxDate,
minDate: minDate,
onChange: onChange
})));
}
Expand Down Expand Up @@ -104,6 +108,8 @@ exports.default = Months;

Months.propTypes = {
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired,
maxDate: _propTypes3.isMaxDate,
minDate: _propTypes3.isMinDate,
onChange: _propTypes2.default.func,
value: _propTypes3.isValue,
valueType: _propTypes2.default.string
Expand Down
Loading

0 comments on commit 82e4e53

Please sign in to comment.