react-infinite-calendar
Version:
Infinite scrolling date-picker built with React, with localization, themes, keyboard support, and more.
1,485 lines (1,205 loc) • 294 kB
JavaScript
/*!
* react-infinite-calendar v2.3.1 - https://github.com/clauderic/react-infinite-calendar
* MIT Licensed
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["InfiniteCalendar"] = factory(require("react"), require("react-dom"));
else
root["InfiniteCalendar"] = factory(root["React"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_91__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 92);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var isDate = __webpack_require__(22)
var MILLISECONDS_IN_HOUR = 3600000
var MILLISECONDS_IN_MINUTE = 60000
var DEFAULT_ADDITIONAL_DIGITS = 2
var parseTokenDateTimeDelimeter = /[T ]/
var parseTokenPlainTime = /:/
// year tokens
var parseTokenYY = /^(\d{2})$/
var parseTokensYYY = [
/^([+-]\d{2})$/, // 0 additional digits
/^([+-]\d{3})$/, // 1 additional digit
/^([+-]\d{4})$/ // 2 additional digits
]
var parseTokenYYYY = /^(\d{4})/
var parseTokensYYYYY = [
/^([+-]\d{4})/, // 0 additional digits
/^([+-]\d{5})/, // 1 additional digit
/^([+-]\d{6})/ // 2 additional digits
]
// date tokens
var parseTokenMM = /^-(\d{2})$/
var parseTokenDDD = /^-?(\d{3})$/
var parseTokenMMDD = /^-?(\d{2})-?(\d{2})$/
var parseTokenWww = /^-?W(\d{2})$/
var parseTokenWwwD = /^-?W(\d{2})-?(\d{1})$/
// time tokens
var parseTokenHH = /^(\d{2}([.,]\d*)?)$/
var parseTokenHHMM = /^(\d{2}):?(\d{2}([.,]\d*)?)$/
var parseTokenHHMMSS = /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/
// timezone tokens
var parseTokenTimezone = /([Z+-].*)$/
var parseTokenTimezoneZ = /^(Z)$/
var parseTokenTimezoneHH = /^([+-])(\d{2})$/
var parseTokenTimezoneHHMM = /^([+-])(\d{2}):?(\d{2})$/
/**
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If an argument is a string, the function tries to parse it.
* Function accepts complete ISO 8601 formats as well as partial implementations.
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
*
* If all above fails, the function passes the given argument to Date constructor.
*
* @param {Date|String|Number} argument - the value to convert
* @param {Object} [options] - the object with options
* @param {0 | 1 | 2} [options.additionalDigits=2] - the additional number of digits in the extended year format
* @returns {Date} the parsed date in the local time zone
*
* @example
* // Convert string '2014-02-11T11:30:30' to date:
* var result = parse('2014-02-11T11:30:30')
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Parse string '+02014101',
* // if the additional number of digits in the extended year format is 1:
* var result = parse('+02014101', {additionalDigits: 1})
* //=> Fri Apr 11 2014 00:00:00
*/
function parse (argument, options) {
if (isDate(argument)) {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime())
} else if (typeof argument !== 'string') {
return new Date(argument)
}
options = options || {}
var additionalDigits = options.additionalDigits
if (additionalDigits == null) {
additionalDigits = DEFAULT_ADDITIONAL_DIGITS
}
var dateStrings = splitDateString(argument)
var parseYearResult = parseYear(dateStrings.date, additionalDigits)
var year = parseYearResult.year
var restDateString = parseYearResult.restDateString
var date = parseDate(restDateString, year)
if (date) {
var timestamp = date.getTime()
var time = 0
var offset
if (dateStrings.time) {
time = parseTime(dateStrings.time)
}
if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone)
} else {
// get offset accurate to hour in timezones that change offset
offset = new Date(timestamp + time).getTimezoneOffset()
offset = new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE).getTimezoneOffset()
}
return new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE)
} else {
return new Date(argument)
}
}
function splitDateString (dateString) {
var dateStrings = {}
var array = dateString.split(parseTokenDateTimeDelimeter)
var timeString
if (parseTokenPlainTime.test(array[0])) {
dateStrings.date = null
timeString = array[0]
} else {
dateStrings.date = array[0]
timeString = array[1]
}
if (timeString) {
var token = parseTokenTimezone.exec(timeString)
if (token) {
dateStrings.time = timeString.replace(token[1], '')
dateStrings.timezone = token[1]
} else {
dateStrings.time = timeString
}
}
return dateStrings
}
function parseYear (dateString, additionalDigits) {
var parseTokenYYY = parseTokensYYY[additionalDigits]
var parseTokenYYYYY = parseTokensYYYYY[additionalDigits]
var token
// YYYY or ±YYYYY
token = parseTokenYYYY.exec(dateString) || parseTokenYYYYY.exec(dateString)
if (token) {
var yearString = token[1]
return {
year: parseInt(yearString, 10),
restDateString: dateString.slice(yearString.length)
}
}
// YY or ±YYY
token = parseTokenYY.exec(dateString) || parseTokenYYY.exec(dateString)
if (token) {
var centuryString = token[1]
return {
year: parseInt(centuryString, 10) * 100,
restDateString: dateString.slice(centuryString.length)
}
}
// Invalid ISO-formatted year
return {
year: null
}
}
function parseDate (dateString, year) {
// Invalid ISO-formatted year
if (year === null) {
return null
}
var token
var date
var month
var week
// YYYY
if (dateString.length === 0) {
date = new Date(0)
date.setUTCFullYear(year)
return date
}
// YYYY-MM
token = parseTokenMM.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
date.setUTCFullYear(year, month)
return date
}
// YYYY-DDD or YYYYDDD
token = parseTokenDDD.exec(dateString)
if (token) {
date = new Date(0)
var dayOfYear = parseInt(token[1], 10)
date.setUTCFullYear(year, 0, dayOfYear)
return date
}
// YYYY-MM-DD or YYYYMMDD
token = parseTokenMMDD.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
var day = parseInt(token[2], 10)
date.setUTCFullYear(year, month, day)
return date
}
// YYYY-Www or YYYYWww
token = parseTokenWww.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
return dayOfISOYear(year, week)
}
// YYYY-Www-D or YYYYWwwD
token = parseTokenWwwD.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
var dayOfWeek = parseInt(token[2], 10) - 1
return dayOfISOYear(year, week, dayOfWeek)
}
// Invalid ISO-formatted date
return null
}
function parseTime (timeString) {
var token
var hours
var minutes
// hh
token = parseTokenHH.exec(timeString)
if (token) {
hours = parseFloat(token[1].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR
}
// hh:mm or hhmm
token = parseTokenHHMM.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseFloat(token[2].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE
}
// hh:mm:ss or hhmmss
token = parseTokenHHMMSS.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseInt(token[2], 10)
var seconds = parseFloat(token[3].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE +
seconds * 1000
}
// Invalid ISO-formatted time
return null
}
function parseTimezone (timezoneString) {
var token
var absoluteOffset
// Z
token = parseTokenTimezoneZ.exec(timezoneString)
if (token) {
return 0
}
// ±hh
token = parseTokenTimezoneHH.exec(timezoneString)
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
}
// ±hh:mm or ±hhmm
token = parseTokenTimezoneHHMM.exec(timezoneString)
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10)
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
}
return 0
}
function dayOfISOYear (isoYear, week, day) {
week = week || 0
day = day || 0
var date = new Date(0)
date.setUTCFullYear(isoYear, 0, 4)
var fourthOfJanuaryDay = date.getUTCDay() || 7
var diff = week * 7 + day + 1 - fourthOfJanuaryDay
date.setUTCDate(date.getUTCDate() + diff)
return date
}
module.exports = parse
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_recompose_withPropsOnChange__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_recompose_withPropsOnChange___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_recompose_withPropsOnChange__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_helpers_util_scrollbarSize__ = __webpack_require__(72);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_dom_helpers_util_scrollbarSize___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_dom_helpers_util_scrollbarSize__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_date_fns_get_days_in_month__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_date_fns_get_days_in_month___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_date_fns_get_days_in_month__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_date_fns_get_day__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_date_fns_get_day___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_date_fns_get_day__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_date_fns_is_after__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_date_fns_is_after___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_date_fns_is_after__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_date_fns_is_before__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_date_fns_is_before___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_date_fns_is_before__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_date_fns_is_same_day__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_date_fns_is_same_day___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_date_fns_is_same_day__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_date_fns_end_of_day__ = __webpack_require__(51);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_date_fns_end_of_day___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_date_fns_end_of_day__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_date_fns_start_of_day__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_date_fns_start_of_day___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_date_fns_start_of_day__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__animate__ = __webpack_require__(44);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_9__animate__["a"]; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return keyCodes; });
/* harmony export (immutable) */ __webpack_exports__["f"] = getMonth;
/* harmony export (immutable) */ __webpack_exports__["i"] = getWeek;
/* harmony export (immutable) */ __webpack_exports__["g"] = getWeeksInMonth;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ScrollSpeed; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return scrollbarSize; });
/* harmony export (immutable) */ __webpack_exports__["b"] = emptyFn;
/* harmony export (immutable) */ __webpack_exports__["m"] = sanitizeDate;
/* harmony export (immutable) */ __webpack_exports__["j"] = getDateString;
/* harmony export (immutable) */ __webpack_exports__["l"] = getMonthsForYear;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return withImmutableProps; });
/* harmony export (immutable) */ __webpack_exports__["d"] = debounce;
/* harmony export (immutable) */ __webpack_exports__["e"] = range;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var keyCodes = {
command: 91,
control: 17,
down: 40,
enter: 13,
escape: 27,
left: 37,
right: 39,
shift: 16,
up: 38
};
/**
* Given a year and a month, returns the rows for that month to be iterated over
* @param {Number} year - the year number
* @param {Number} month - the index of the month
* @param {Number} weekStartsOn - the index of the first day of the week (from 0 to 6)
* @return {Object} - Returns the first day of the month and the rows of that month
*/
function getMonth(year, month, weekStartsOn) {
var rows = [];
var monthDate = new Date(year, month, 1);
var daysInMonth = __WEBPACK_IMPORTED_MODULE_2_date_fns_get_days_in_month___default()(monthDate);
var weekEndsOn = getEndOfWeekIndex(weekStartsOn);
var dow = __WEBPACK_IMPORTED_MODULE_3_date_fns_get_day___default()(new Date(year, month, 1));
var week = 0;
for (var day = 1; day <= daysInMonth; day++) {
if (!rows[week]) {
rows[week] = [];
}
rows[week].push(day);
if (dow === weekEndsOn) {
week++;
}
dow = dow < 6 ? dow + 1 : 0;
}
return {
date: monthDate,
rows: rows
};
}
function getWeek(yearStart, date, weekStartsOn) {
var yearStartDate = typeof yearStart === 'number' ? new Date(yearStart, 0, 1) // 1st Jan of the Year
: yearStart;
return Math.ceil((Math.round((date - yearStartDate) / (60 * 60 * 24 * 1000)) + yearStartDate.getDay() + 1 - weekStartsOn) / 7);
}
/**
* Get the number of weeks in a given month to be able to calculate the height of that month
* @param {Number} year - the year number
* @param {Number} month - the index of the month
* @param {Number} weekStartsOn - the index of the first day of the week (from 0 to 6)
* @return {Number} - Returns the number of weeks for the given month
*/
function getWeeksInMonth(month) {
var year = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date().getFullYear();
var weekStartsOn = arguments[2];
var isLastDisplayedMonth = arguments[3];
var weekEndsOn = getEndOfWeekIndex(weekStartsOn);
var firstOfMonth = new Date(year, month, 1);
var firstWeekNumber = getWeek(year, firstOfMonth, weekStartsOn);
var lastOfMonth = new Date(year, month + 1, 0); // Last date of the Month
var lastWeekNumber = getWeek(year, lastOfMonth, weekStartsOn);
var rowCount = lastWeekNumber - firstWeekNumber;
// If the last week contains 7 days, we need to add an extra row
if (lastOfMonth.getDay() === weekEndsOn || isLastDisplayedMonth) {
rowCount++;
}
return rowCount;
}
/**
* Helper to find out what day the week ends on given the localized start of the week
* @param {Number} weekStartsOn - the index of the first day of the week (from 0 to 6)
* @return {Number} - Returns the index of the day the week ends on
*/
function getEndOfWeekIndex(weekStartsOn) {
var weekEndsOn = weekStartsOn === 0 ? 6 : weekStartsOn - 1;
return weekEndsOn;
}
var ScrollSpeed = function () {
function ScrollSpeed() {
var _this = this;
_classCallCheck(this, ScrollSpeed);
this.clear = function () {
_this.lastPosition = null;
_this.delta = 0;
};
}
ScrollSpeed.prototype.getScrollSpeed = function getScrollSpeed(scrollOffset) {
if (this.lastPosition != null) {
this.delta = scrollOffset - this.lastPosition;
}
this.lastPosition = scrollOffset;
clearTimeout(this._timeout);
this._timeout = setTimeout(this.clear, 50);
return this.delta;
};
return ScrollSpeed;
}();
var scrollbarSize = __WEBPACK_IMPORTED_MODULE_1_dom_helpers_util_scrollbarSize___default()();
function emptyFn() {
/* no-op */
}
function sanitizeDate(date, _ref) {
var _ref$disabledDates = _ref.disabledDates,
disabledDates = _ref$disabledDates === undefined ? [] : _ref$disabledDates,
_ref$disabledDays = _ref.disabledDays,
disabledDays = _ref$disabledDays === undefined ? [] : _ref$disabledDays,
minDate = _ref.minDate,
maxDate = _ref.maxDate;
// Selected date should not be disabled or outside the selectable range
if (!date || disabledDates.some(function (disabledDate) {
return __WEBPACK_IMPORTED_MODULE_6_date_fns_is_same_day___default()(disabledDate, date);
}) || disabledDays && disabledDays.indexOf(__WEBPACK_IMPORTED_MODULE_3_date_fns_get_day___default()(date)) !== -1 || minDate && __WEBPACK_IMPORTED_MODULE_5_date_fns_is_before___default()(date, __WEBPACK_IMPORTED_MODULE_8_date_fns_start_of_day___default()(minDate)) || maxDate && __WEBPACK_IMPORTED_MODULE_4_date_fns_is_after___default()(date, __WEBPACK_IMPORTED_MODULE_7_date_fns_end_of_day___default()(maxDate))) {
return null;
}
return date;
}
function getDateString(year, month, date) {
return year + '-' + ('0' + (month + 1)).slice(-2) + '-' + ('0' + date).slice(-2);
}
function getMonthsForYear(year) {
var day = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
return Array.apply(null, Array(12)).map(function (val, index) {
return new Date(year, index, day);
});
}
var withImmutableProps = function withImmutableProps(props) {
return __WEBPACK_IMPORTED_MODULE_0_recompose_withPropsOnChange___default()(function () {
return false;
}, props);
};
function debounce(callback, wait) {
var _this2 = this;
var timeout = null;
var callbackArgs = null;
var later = function later() {
return callback.apply(_this2, callbackArgs);
};
return function () {
callbackArgs = arguments;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
function range(start, stop) {
var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var length = Math.max(Math.ceil((stop - start) / step), 0);
var range = Array(length);
for (var i = 0; i < length; i++, start += step) {
range[i] = start;
}
return range;
};
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
if (true) {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(75)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = require('./factoryWithThrowingShims')();
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var getDayOfYear = __webpack_require__(52)
var getISOWeek = __webpack_require__(54)
var getISOYear = __webpack_require__(21)
var parse = __webpack_require__(0)
var isValid = __webpack_require__(58)
var enLocale = __webpack_require__(62)
/**
* @category Common Helpers
* @summary Format the date.
*
* @description
* Return the formatted date string in the given format.
*
* Accepted tokens:
* | Unit | Token | Result examples |
* |-------------------------|-------|----------------------------------|
* | Month | M | 1, 2, ..., 12 |
* | | Mo | 1st, 2nd, ..., 12th |
* | | MM | 01, 02, ..., 12 |
* | | MMM | Jan, Feb, ..., Dec |
* | | MMMM | January, February, ..., December |
* | Quarter | Q | 1, 2, 3, 4 |
* | | Qo | 1st, 2nd, 3rd, 4th |
* | Day of month | D | 1, 2, ..., 31 |
* | | Do | 1st, 2nd, ..., 31st |
* | | DD | 01, 02, ..., 31 |
* | Day of year | DDD | 1, 2, ..., 366 |
* | | DDDo | 1st, 2nd, ..., 366th |
* | | DDDD | 001, 002, ..., 366 |
* | Day of week | d | 0, 1, ..., 6 |
* | | do | 0th, 1st, ..., 6th |
* | | dd | Su, Mo, ..., Sa |
* | | ddd | Sun, Mon, ..., Sat |
* | | dddd | Sunday, Monday, ..., Saturday |
* | Day of ISO week | E | 1, 2, ..., 7 |
* | ISO week | W | 1, 2, ..., 53 |
* | | Wo | 1st, 2nd, ..., 53rd |
* | | WW | 01, 02, ..., 53 |
* | Year | YY | 00, 01, ..., 99 |
* | | YYYY | 1900, 1901, ..., 2099 |
* | ISO week-numbering year | GG | 00, 01, ..., 99 |
* | | GGGG | 1900, 1901, ..., 2099 |
* | AM/PM | A | AM, PM |
* | | a | am, pm |
* | | aa | a.m., p.m. |
* | Hour | H | 0, 1, ... 23 |
* | | HH | 00, 01, ... 23 |
* | | h | 1, 2, ..., 12 |
* | | hh | 01, 02, ..., 12 |
* | Minute | m | 0, 1, ..., 59 |
* | | mm | 00, 01, ..., 59 |
* | Second | s | 0, 1, ..., 59 |
* | | ss | 00, 01, ..., 59 |
* | 1/10 of second | S | 0, 1, ..., 9 |
* | 1/100 of second | SS | 00, 01, ..., 99 |
* | Millisecond | SSS | 000, 001, ..., 999 |
* | Timezone | Z | -01:00, +00:00, ... +12:00 |
* | | ZZ | -0100, +0000, ..., +1200 |
* | Seconds timestamp | X | 512969520 |
* | Milliseconds timestamp | x | 512969520900 |
*
* The characters wrapped in square brackets are escaped.
*
* The result may vary by locale.
*
* @param {Date|String|Number} date - the original date
* @param {String} [format='YYYY-MM-DDTHH:mm:ss.SSSZ'] - the string of tokens
* @param {Object} [options] - the object with options
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the formatted date string
*
* @example
* // Represent 11 February 2014 in middle-endian format:
* var result = format(
* new Date(2014, 1, 11),
* 'MM/DD/YYYY'
* )
* //=> '02/11/2014'
*
* @example
* // Represent 2 July 2014 in Esperanto:
* var eoLocale = require('date-fns/locale/eo')
* var result = format(
* new Date(2014, 6, 2),
* 'Do [de] MMMM YYYY',
* {locale: eoLocale}
* )
* //=> '2-a de julio 2014'
*/
function format (dirtyDate, formatStr, options) {
formatStr = formatStr || 'YYYY-MM-DDTHH:mm:ss.SSSZ'
options = options || {}
var locale = options.locale
var localeFormatters = enLocale.format.formatters
var formattingTokensRegExp = enLocale.format.formattingTokensRegExp
if (locale && locale.format && locale.format.formatters) {
localeFormatters = locale.format.formatters
if (locale.format.formattingTokensRegExp) {
formattingTokensRegExp = locale.format.formattingTokensRegExp
}
}
var date = parse(dirtyDate)
if (!isValid(date)) {
return 'Invalid Date'
}
var formatFn = buildFormatFn(formatStr, localeFormatters, formattingTokensRegExp)
return formatFn(date)
}
var formatters = {
// Month: 1, 2, ..., 12
'M': function (date) {
return date.getMonth() + 1
},
// Month: 01, 02, ..., 12
'MM': function (date) {
return addLeadingZeros(date.getMonth() + 1, 2)
},
// Quarter: 1, 2, 3, 4
'Q': function (date) {
return Math.ceil((date.getMonth() + 1) / 3)
},
// Day of month: 1, 2, ..., 31
'D': function (date) {
return date.getDate()
},
// Day of month: 01, 02, ..., 31
'DD': function (date) {
return addLeadingZeros(date.getDate(), 2)
},
// Day of year: 1, 2, ..., 366
'DDD': function (date) {
return getDayOfYear(date)
},
// Day of year: 001, 002, ..., 366
'DDDD': function (date) {
return addLeadingZeros(getDayOfYear(date), 3)
},
// Day of week: 0, 1, ..., 6
'd': function (date) {
return date.getDay()
},
// Day of ISO week: 1, 2, ..., 7
'E': function (date) {
return date.getDay() || 7
},
// ISO week: 1, 2, ..., 53
'W': function (date) {
return getISOWeek(date)
},
// ISO week: 01, 02, ..., 53
'WW': function (date) {
return addLeadingZeros(getISOWeek(date), 2)
},
// Year: 00, 01, ..., 99
'YY': function (date) {
return addLeadingZeros(date.getFullYear(), 4).substr(2)
},
// Year: 1900, 1901, ..., 2099
'YYYY': function (date) {
return addLeadingZeros(date.getFullYear(), 4)
},
// ISO week-numbering year: 00, 01, ..., 99
'GG': function (date) {
return String(getISOYear(date)).substr(2)
},
// ISO week-numbering year: 1900, 1901, ..., 2099
'GGGG': function (date) {
return getISOYear(date)
},
// Hour: 0, 1, ... 23
'H': function (date) {
return date.getHours()
},
// Hour: 00, 01, ..., 23
'HH': function (date) {
return addLeadingZeros(date.getHours(), 2)
},
// Hour: 1, 2, ..., 12
'h': function (date) {
var hours = date.getHours()
if (hours === 0) {
return 12
} else if (hours > 12) {
return hours % 12
} else {
return hours
}
},
// Hour: 01, 02, ..., 12
'hh': function (date) {
return addLeadingZeros(formatters['h'](date), 2)
},
// Minute: 0, 1, ..., 59
'm': function (date) {
return date.getMinutes()
},
// Minute: 00, 01, ..., 59
'mm': function (date) {
return addLeadingZeros(date.getMinutes(), 2)
},
// Second: 0, 1, ..., 59
's': function (date) {
return date.getSeconds()
},
// Second: 00, 01, ..., 59
'ss': function (date) {
return addLeadingZeros(date.getSeconds(), 2)
},
// 1/10 of second: 0, 1, ..., 9
'S': function (date) {
return Math.floor(date.getMilliseconds() / 100)
},
// 1/100 of second: 00, 01, ..., 99
'SS': function (date) {
return addLeadingZeros(Math.floor(date.getMilliseconds() / 10), 2)
},
// Millisecond: 000, 001, ..., 999
'SSS': function (date) {
return addLeadingZeros(date.getMilliseconds(), 3)
},
// Timezone: -01:00, +00:00, ... +12:00
'Z': function (date) {
return formatTimezone(date.getTimezoneOffset(), ':')
},
// Timezone: -0100, +0000, ... +1200
'ZZ': function (date) {
return formatTimezone(date.getTimezoneOffset())
},
// Seconds timestamp: 512969520
'X': function (date) {
return Math.floor(date.getTime() / 1000)
},
// Milliseconds timestamp: 512969520900
'x': function (date) {
return date.getTime()
}
}
function buildFormatFn (formatStr, localeFormatters, formattingTokensRegExp) {
var array = formatStr.match(formattingTokensRegExp)
var length = array.length
var i
var formatter
for (i = 0; i < length; i++) {
formatter = localeFormatters[array[i]] || formatters[array[i]]
if (formatter) {
array[i] = formatter
} else {
array[i] = removeFormattingTokens(array[i])
}
}
return function (date) {
var output = ''
for (var i = 0; i < length; i++) {
if (array[i] instanceof Function) {
output += array[i](date, formatters)
} else {
output += array[i]
}
}
return output
}
}
function removeFormattingTokens (input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|]$/g, '')
}
return input.replace(/\\/g, '')
}
function formatTimezone (offset, delimeter) {
delimeter = delimeter || ''
var sign = offset > 0 ? '-' : '+'
var absOffset = Math.abs(offset)
var hours = Math.floor(absOffset / 60)
var minutes = absOffset % 60
return sign + addLeadingZeros(hours, 2) + delimeter + addLeadingZeros(minutes, 2)
}
function addLeadingZeros (number, targetLength) {
var output = Math.abs(number).toString()
while (output.length < targetLength) {
output = '0' + output
}
return output
}
module.exports = format
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var createHelper = function createHelper(func, helperName) {
var setDisplayName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var noArgs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if ("development" !== 'production' && setDisplayName) {
var _ret = function () {
/* eslint-disable global-require */
var wrapDisplayName = __webpack_require__(89).default;
/* eslint-enable global-require */
if (noArgs) {
return {
v: function v(BaseComponent) {
var Component = func(BaseComponent);
Component.displayName = wrapDisplayName(BaseComponent, helperName);
return Component;
}
};
}
return {
v: function v() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return function (BaseComponent) {
var Component = func.apply(undefined, args)(BaseComponent);
Component.displayName = wrapDisplayName(BaseComponent, helperName);
return Component;
};
}
};
}();
if (typeof _ret === "object") return _ret.v;
}
return func;
};
exports.default = createHelper;
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_recompose_defaultProps__ = __webpack_require__(80);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_recompose_defaultProps___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_recompose_defaultProps__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prop_types__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_prop_types__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_classnames__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_classnames__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_defaultDisplayOptions__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_defaultDisplayOptions___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__utils_defaultDisplayOptions__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_defaultLocale__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_defaultLocale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__utils_defaultLocale__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_defaultTheme__ = __webpack_require__(47);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_defaultTheme___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__utils_defaultTheme__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Today__ = __webpack_require__(41);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__Header__ = __webpack_require__(36);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__MonthList__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Weekdays__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__Years__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__Day__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_date_fns_parse__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_date_fns_parse___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_14_date_fns_parse__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_date_fns_format__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_date_fns_format___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_15_date_fns_format__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_date_fns_start_of_day__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_date_fns_start_of_day___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16_date_fns_start_of_day__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return withDefaultProps; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Calendar; });
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _class,
_temp,
_jsxFileName = '/Users/claudericdemers/react-infinite-calendar/src/Calendar/index.js';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var styles = {
container: {
'root': 'Cal__Container__root',
'landscape': 'Cal__Container__landscape',
'wrapper': 'Cal__Container__wrapper',
'listWrapper': 'Cal__Container__listWrapper'
},
day: {
'root': 'Cal__Day__root',
'enabled': 'Cal__Day__enabled',
'highlighted': 'Cal__Day__highlighted',
'today': 'Cal__Day__today',
'disabled': 'Cal__Day__disabled',
'selected': 'Cal__Day__selected',
'month': 'Cal__Day__month',
'year': 'Cal__Day__year',
'selection': 'Cal__Day__selection',
'day': 'Cal__Day__day',
'range': 'Cal__Day__range',
'start': 'Cal__Day__start',
'end': 'Cal__Day__end',
'betweenRange': 'Cal__Day__betweenRange'
}
};
var withDefaultProps = __WEBPACK_IMPORTED_MODULE_0_recompose_defaultProps___default()({
autoFocus: true,
DayComponent: __WEBPACK_IMPORTED_MODULE_13__Day__["a" /* default */],
display: 'days',
displayOptions: {},
HeaderComponent: __WEBPACK_IMPORTED_MODULE_9__Header__["a" /* default */],
height: 500,
keyboardSupport: true,
max: new Date(2050, 11, 31),
maxDate: new Date(2050, 11, 31),
min: new Date(1980, 0, 1),
minDate: new Date(1980, 0, 1),
onHighlightedDateChange: __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* emptyFn */],
onScroll: __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* emptyFn */],
onScrollEnd: __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* emptyFn */],
onSelect: __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* emptyFn */],
passThrough: {},
rowHeight: 56,
tabIndex: 1,
width: 400,
YearsComponent: __WEBPACK_IMPORTED_MODULE_12__Years__["a" /* default */]
});
var Calendar = (_temp = _class = function (_Component) {
_inherits(Calendar, _Component);
function Calendar(props) {
_classCallCheck(this, Calendar);
var _this = _possibleConstructorReturn(this, _Component.apply(this, arguments));
_this._displayOptions = {};
_this._locale = {};
_this._theme = {};
_this.getCurrentOffset = function () {
return _this.scrollTop;
};
_this.getDateOffset = function (date) {
return _this._MonthList && _this._MonthList.getDateOffset(date);
};
_this.scrollTo = function (offset) {
return _this._MonthList && _this._MonthList.scrollTo(offset);
};
_this.scrollToDate = function () {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
var offset = arguments[1];
var shouldAnimate = arguments[2];
var display = _this.props.display;
return _this._MonthList && _this._MonthList.scrollToDate(date, offset, shouldAnimate && display === 'days', function () {
return _this.setState({ isScrolling: false });
});
};
_this.getScrollSpeed = new __WEBPACK_IMPORTED_MODULE_4__utils__["c" /* ScrollSpeed */]().getScrollSpeed;
_this.handleScroll = function (scrollTop, e) {
var _this$props = _this.props,
onScroll = _this$props.onScroll,
rowHeight = _this$props.rowHeight;
var isScrolling = _this.state.isScrolling;
var _this$getDisplayOptio = _this.getDisplayOptions(),
showTodayHelper = _this$getDisplayOptio.showTodayHelper,
showOverlay = _this$getDisplayOptio.showOverlay;
var scrollSpeed = _this.scrollSpeed = Math.abs(_this.getScrollSpeed(scrollTop));
_this.scrollTop = scrollTop;
// We only want to display the months overlay if the user is rapidly scrolling
if (showOverlay && scrollSpeed > rowHeight && !isScrolling) {
_this.setState({
isScrolling: true
});
}
if (showTodayHelper) {
_this.updateTodayHelperPosition(scrollSpeed);
}
onScroll(scrollTop, e);
_this.handleScrollEnd();
};
_this.handleScrollEnd = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__utils__["d" /* debounce */])(function () {
var onScrollEnd = _this.props.onScrollEnd;
var isScrolling = _this.state.isScrolling;
var _this$getDisplayOptio2 = _this.getDisplayOptions(),
showTodayHelper = _this$getDisplayOptio2.showTodayHelper;
if (isScrolling) {
_this.setState({ isScrolling: false });
}
if (showTodayHelper) {
_this.updateTodayHelperPosition(0);
}
onScrollEnd(_this.scrollTop);
}, 150);
_this.updateTodayHelperPosition = function (scrollSpeed) {
var today = _this.today;
var scrollTop = _this.scrollTop;
var showToday = _this.state.showToday;
var _this$props2 = _this.props,
height = _this$props2.height,
rowHeight = _this$props2.rowHeight;
var _this$getDisplayOptio3 = _this.getDisplayOptions(),
todayHelperRowOffset = _this$getDisplayOptio3.todayHelperRowOffset;
var newState = void 0;
if (!_this._todayOffset) {
_this._todayOffset = _this.getDateOffset(today);
}
// Today is above the fold
if (scrollTop >= _this._todayOffset + (height - rowHeight) / 2 + rowHeight * todayHelperRowOffset) {
if (showToday !== __WEBPACK_IMPORTED_MODULE_8__Today__["a" /* DIRECTION_UP */]) newState = __WEBPACK_IMPORTED_MODULE_8__Today__["a" /* DIRECTION_UP */];
}
// Today is below the fold
else if (scrollTop <= _this._todayOffset - height / 2 - rowHeight * (todayHelperRowOffset + 1)) {
if (showToday !== __WEBPACK_IMPORTED_MODULE_8__Today__["b" /* DIRECTION_DOWN */]) newState = __WEBPACK_IMPORTED_MODULE_8__Today__["b" /* DIRECTION_DOWN */];
} else if (showToday && scrollSpeed <= 1) {
newState = false;
}
if (scrollTop === 0) {
newState = false;
}
if (newState != null) {
_this.setState({ showToday: newState });
}
};
_this.setDisplay = function (display) {
_this.setState({ display: display });
};
_this.updateYears(props);
_this.state = {
display: props.display
};
return _this;
}
Calendar.prototype.componentDidMount = function componentDidMount() {
var autoFocus = this.props.autoFocus;
if (autoFocus) {
this.node.focus();
}
};
Calendar.prototype.componentWillUpdate = function componentWillUpdate(nextProps, nextState) {
var _props = this.props,
min = _props.min,
minDate = _props.minDate,
max = _props.max,
maxDate = _props.maxDate;
if (nextProps.min !== min || nextProps.minDate !== minDate || nextProps.max !== max || nextProps.maxDate !== maxDate) {
this.updateYears(nextProps);
}
if (nextProps.display !== this.props.display) {
this.setState({ display: nextProps.display });
}
};
Calendar.prototype.updateYears = function updateYears() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
this._min = __WEBPACK_IMPORTED_MODULE_14_date_fns_parse___default()(props.min);
this._max = __WEBPACK_IMPORTED_MODULE_14_date_fns_parse___default()(props.max);
this._minDate = __WEBPACK_IMPORTED_MODULE_14_date_fns_parse___default()(props.minDate);
this._maxDate = __WEBPACK_IMPORTED_MODULE_14_date_fns_parse___default()(props.maxDate);
var min = this._min.getFullYear();
var minMonth = this._min.getMonth();
var max = this._max.getFullYear();
var maxMonth = this._max.getMonth();
var months = [];
var year = void 0,
month = void 0;
for (year = min; year <= max; year++) {
for (month = 0; month < 12; month++) {
if (year === min && month < minMonth || year === max && month > maxMonth) {
continue;
}
months.push({ month: month, year: year });
}
}
this.months = months;
};
Calendar.prototype.getDisabledDates = function getDisabledDates(disabledDates) {
return disabledDates && disabledDates.map(function (date) {
return __WEBPACK_IMPORTED_MODULE_15_date_fns_format___default()(__WEBPACK_IMPORTED_MODULE_14_date_fns_parse___default()(date), 'YYYY-MM-DD');
});
};
Calendar.prototype.getDisplayOptions = function getDisplayOptions() {
var displayOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.displayOptions;
return Object.assign(this._displayOptions, __WEBPACK_IMPORTED_MODULE_5__utils_defaultDisplayOptions___default.a, displayOptions);
};
Calendar.prototype.getLocale = function getLocale() {
return Object.assign(this._locale, __WEBPACK_IMPORTED_MODULE_6__utils_defaultLocale___default.a, this.props.locale);
};
Calendar.prototype.getTheme = function getTheme() {
return Object.assign(this._theme, __WEBPACK_IMPORTED_MODULE_7__utils_defaultTheme___default.a, this.props.theme);
};
Calendar.prototype.render = function render() {
var _classNames,
_this2 = this;
var _props2 = this.props,
className = _props2.className,
passThrough = _props2.passThrough,
DayComponent = _props2.DayComponent,
disabledDays = _props2.disabledDays,
displayDate = _props2.displayDate,
height = _props2.height,
HeaderComponent = _props2.HeaderComponent,
rowHeight = _props2.rowHeight,
scrollDate = _props2.scrollDate,
selected = _props2.selected,
tabIndex = _props2.tabIndex,
width = _props2.width,
YearsComponent = _props2.YearsComponent;
var _getDisplayOptions = this.getDisplayOptions(),
hideYearsOnSelect = _getDisplayOptions.hideYearsOnSelect,
layout = _getDisplayOptions.layout,
overscanMonthCount = _getDisplayOptions.overscanMonthCount,
shouldHeaderAnimate = _getDisplayOptions.shouldHeaderAnimate,
showHeader = _getDisplayOptions.showHeader,
showMonthsForYears = _getDisplayOptions.showMonths