vue-time-date-range-picker
Version:
a vue time date range picker
1,008 lines (945 loc) • 86.5 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("moment"), require("vue"));
else if(typeof define === 'function' && define.amd)
define(["moment", "vue"], factory);
else if(typeof exports === 'object')
exports["vdprDatePicker"] = factory(require("moment"), require("vue"));
else
root["vdprDatePicker"] = factory(root["moment"], root["Vue"]);
})(self, (__WEBPACK_EXTERNAL_MODULE__192__, __WEBPACK_EXTERNAL_MODULE__976__) => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 744:
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({ value: true }));
// runtime helper for setting properties on components
// in a tree-shakable way
exports["default"] = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
/***/ }),
/***/ 192:
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__192__;
/***/ }),
/***/ 976:
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__976__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"CalendarDialog": () => (/* reexport */ CalendarDialog),
"default": () => (/* binding */ DatePicker)
});
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","amd":"vue","root":"Vue"}
var external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_ = __webpack_require__(976);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/Components/DatePicker.vue?vue&type=template&id=5d8b0929
var _hoisted_1 = {
"class": "vdpr-datepicker"
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
var _component_date_input = (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.resolveComponent)("date-input");
var _component_calendar_dialog = (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.resolveComponent)("calendar-dialog");
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("div", _hoisted_1, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_date_input, {
type: $options.showingDateInput ? 'text' : 'hidden',
language: $props.language,
selectedStartDate: $data.selectedStartDate,
selectedEndDate: $data.selectedEndDate,
format: $props.format,
sameDateFormat: $props.sameDateFormat,
refName: $props.dateInput.refName,
inputClass: $props.dateInput.inputClass,
name: $props.dateInput.name,
id: $props.dateInput.id,
placeholder: $props.dateInput.placeholder,
required: $props.dateInput.required,
onOnClick: $options.onClickDateInput
}, null, 8 /* PROPS */, ["type", "language", "selectedStartDate", "selectedEndDate", "format", "sameDateFormat", "refName", "inputClass", "name", "id", "placeholder", "required", "onOnClick"]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.withDirectives)((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_calendar_dialog, {
language: $props.language,
inline: $props.inline,
initialDates: $props.initialDates,
disabledDates: $props.disabledDates,
availableDates: $props.availableDates,
showHelperButtons: $props.showHelperButtons,
helperButtons: $props.helperButtons,
dateInput: $props.calendarDateInput,
timeInput: $props.calendarTimeInput,
switchButtonLabel: $props.switchButtonLabel,
switchButtonInitial: $props.switchButtonInitial,
applyButtonLabel: $props.applyButtonLabel,
resetButtonLabel: $props.resetButtonLabel,
isMondayFirst: $props.isMondayFirst,
onOnApply: $options.onApply,
onOnReset: $options.onReset,
onSelectDate: $options.selectDate,
onSelectDisabledDate: $options.selectDisabledDate,
onOnPrevCalendar: $options.onPrevCalendar,
onOnNextCalendar: $options.onNextCalendar
}, null, 8 /* PROPS */, ["language", "inline", "initialDates", "disabledDates", "availableDates", "showHelperButtons", "helperButtons", "dateInput", "timeInput", "switchButtonLabel", "switchButtonInitial", "applyButtonLabel", "resetButtonLabel", "isMondayFirst", "onOnApply", "onOnReset", "onSelectDate", "onSelectDisabledDate", "onOnPrevCalendar", "onOnNextCalendar"]), [[external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.vShow, $options.showingCalendarDialog]])]);
}
;// CONCATENATED MODULE: ./src/Components/DatePicker.vue?vue&type=template&id=5d8b0929
;// CONCATENATED MODULE: ./src/Utils/Util.js
/* harmony default export */ const Util = ({
/**
* Check if value is Date Object
*
* @param {*} value
* @returns {Boolean}
*/
isObjectDate: function isObjectDate(value) {
return Object.prototype.toString.call(value) === '[object Date]';
},
/**
* Get Object Length
*
* @param {Object} value
* @returns {Number}
*/
getObjectLength: function getObjectLength(value) {
return Object.keys(value).length;
},
/**
* Check if disabled/available date object is empty
*
* @param {Object} value
* @returns {Boolean}
*/
isEmptyObject: function isEmptyObject(value) {
if (value) {
if (Object.keys(value).length > 0) {
return false;
}
}
return true;
}
});
;// CONCATENATED MODULE: ./src/Utils/PropsValidator.js
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/* harmony default export */ const PropsValidator = ({
/**
* @param {Array} value
* @returns {Boolean}
*/
isValidInitialDate: function isValidInitialDate(value) {
if (!value || value.length === 0) return true;
var _value = _slicedToArray(value, 2),
from = _value[0],
to = _value[1];
return Util.isObjectDate(from) && Util.isObjectDate(to) && to.getTime() >= from.getTime();
},
/**
* @param {Array} value
* @returns {Boolean}
*/
isValidHelperButtons: function isValidHelperButtons(value) {
if (!value || value.length === 0) return true;
var filtered = value.filter(function (button) {
var isButtonNameValid = typeof button.name === 'string' && button.name !== '';
var isButtonFromDateValid = Util.isObjectDate(button.from);
var isButtonToDateValid = Util.isObjectDate(button.to);
return isButtonNameValid && isButtonFromDateValid && isButtonToDateValid;
});
return value.length === filtered.length;
},
/**
* @param {Object} value
* @returns {Boolean}
*/
isValidDateRestriction: function isValidDateRestriction(value) {
if (!value || Util.getObjectLength(value) === 0) return true;
var dates = value.dates,
from = value.from,
to = value.to,
ranges = value.ranges,
custom = value.custom;
if (Array.isArray(dates)) {
var filteredValidDates = dates.filter(function (date) {
return Util.isObjectDate(date);
});
if (filteredValidDates.length !== dates.length) {
return false;
}
}
if (typeof from !== 'undefined' && !Util.isObjectDate(from)) {
return false;
}
if (typeof to !== 'undefined' && !Util.isObjectDate(to)) {
return false;
}
if (Array.isArray(ranges)) {
var filterValidRanges = ranges.filter(function (range) {
return Util.isObjectDate(range.from) && Util.isObjectDate(range.to);
});
if (filterValidRanges.length !== ranges.length) {
return false;
}
}
if (typeof custom !== 'undefined' && typeof custom !== 'function') {
return false;
}
return true;
},
/**
* @param {Object} value
* @returns {Boolean}
*/
isValidSameDateFormat: function isValidSameDateFormat(value) {
if (!value || Util.getObjectLength(value) === 0) return true;
var from = value.from,
to = value.to;
if (typeof from !== 'string' || typeof to !== 'string') {
return false;
}
return true;
}
});
// EXTERNAL MODULE: external "moment"
var external_moment_ = __webpack_require__(192);
var external_moment_default = /*#__PURE__*/__webpack_require__.n(external_moment_);
;// CONCATENATED MODULE: ./src/Utils/DateUtil.js
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
// eslint-disable-next-line import/no-unresolved
var _default = /*#__PURE__*/function () {
/**
* @param {String} lang
*/
function _default() {
var lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
_classCallCheck(this, _default);
this.lang = lang;
this.localMoment = external_moment_default()().locale(lang);
}
/**
* Create Date
* @returns {Date}
*/
_createClass(_default, [{
key: "createDate",
value: function createDate() {
return external_moment_default().apply(void 0, arguments).locale(this.lang).toDate();
}
/**
* Get Day Names
*
* @returns {Array}
*/
}, {
key: "getDayNames",
value: function getDayNames() {
return this.localMoment.localeData().weekdays();
}
/**
* Get Abbreviated Day Names
*
* @returns {Array}
*/
}, {
key: "getAbbrDayNames",
value: function getAbbrDayNames() {
return this.localMoment.localeData().weekdaysShort();
}
/**
* Get Month Names
* @returns {Array}
*/
}, {
key: "getMonthNames",
value: function getMonthNames() {
return this.localMoment.localeData().months();
}
/**
* Get Abbreviated Month Names
*
* @returns {Array}
*/
}, {
key: "getAbbrMonthNames",
value: function getAbbrMonthNames() {
return this.localMoment.localeData().monthsShort();
}
/**
* format a date
*
* @param {Date} date
* @param {String} format
* @returns {String}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "formatDate",
value: function formatDate(date, format) {
return external_moment_default()(date).locale(this.lang).format(format);
}
/**
* check for same date only
*
* @param {Date} date1
* @param {Date} date2
* @return {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isSameDate",
value: function isSameDate(date1, date2) {
return external_moment_default()(date1).format('DD MM YYYY') === external_moment_default()(date2).format('DD MM YYYY');
}
/**
* Check for is All Day.
*
* @param {Date} fromDate
* @param {Date} toDate
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isAllDay",
value: function isAllDay(fromDate, toDate) {
var startFromDate = external_moment_default()(fromDate).startOf('day');
var endToDate = external_moment_default()(toDate).endOf('day');
return external_moment_default()(fromDate).format('DD MM YYYY HH:mm') === startFromDate.format('DD MM YYYY HH:mm') && external_moment_default()(toDate).format('DD MM YYYY HH:mm') === endToDate.format('DD MM YYYY HH:mm');
}
/**
* check if date is valid
*
* @param {Date} date
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isValidDate",
value: function isValidDate(date) {
return Util.isObjectDate(date) && external_moment_default()(date).isValid();
}
/**
* convert date to unix timestamp
*
* @param {Date} date
* @returns {Number}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "toUnix",
value: function toUnix(date) {
return external_moment_default()(date).unix();
}
/**
* convert unix to date
*
* @param {Number} unixTimestamp
* @returns {Date}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "fromUnix",
value: function fromUnix(unixTimestamp) {
return external_moment_default().unix(unixTimestamp).toDate();
}
/**
* Get Start Of A Date. refer to moment documentation
*
* @param {Date} date
* @param {String} of
* @returns {Date}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "startOf",
value: function startOf(date, of) {
return external_moment_default()(date).locale(this.lang).startOf(of).toDate();
}
/**
* Get End Of A Date. refer to moment documentation
*
* @param {Date} date
* @param {String} of
* @returns {Date}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "endOf",
value: function endOf(date, of) {
return external_moment_default()(date).locale(this.lang).endOf(of).toDate();
}
/**
* Check if date is before a beforeDate
*
* @param {Date} date
* @param {Date} beforeDate
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isBefore",
value: function isBefore(date, beforeDate) {
return external_moment_default()(date).isBefore(beforeDate);
}
/**
* Check if date is same or before a beforeDate
* @param {Date} date
* @param {Date} beforeDate
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isSameOrBefore",
value: function isSameOrBefore(date, beforeDate) {
return external_moment_default()(date).isSameOrBefore(beforeDate);
}
/**
* Check if date is after a afterDate
*
* @param {Date} date
* @param {Date} beforeDate
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isAfter",
value: function isAfter(date, afterDate) {
return external_moment_default()(date).isAfter(afterDate);
}
/**
* Check if date is same or after a afterDate
* @param {Date} date
* @param {Date} afterDate
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isSameOrAfter",
value: function isSameOrAfter(date, afterDate) {
return external_moment_default()(date).isSameOrAfter(afterDate);
}
/**
* Check if a date is between fromDate and toDate
* @param {Date} date
* @param {Date} fromDate
* @param {Date} toDate
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isBetween",
value: function isBetween(date, fromDate, toDate) {
return external_moment_default()(date).isBetween(fromDate, toDate);
}
/**
* Check if a date is same or between as fromDate and toDate
*
* @param {Date} date
* @param {Date} fromDate
* @param {Date} toDate
* @returns {Boolean}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "isSameOrBetween",
value: function isSameOrBetween(date, fromDate, toDate) {
var theDate = external_moment_default()(date);
return theDate.isSameOrAfter(fromDate) && theDate.isSameOrBefore(toDate);
}
/**
* Add Number of timeKey to A Date. refer to moment documentation
*
* @param {Date} date
* @param {Number} number
* @param {String} timeKey
* @returns {Date}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "add",
value: function add(date, number, timeKey) {
return external_moment_default()(date).locale(this.lang).add(number, timeKey).toDate();
}
/**
* Subtract Number of timeKey to A Date. refer to moment documentation
*
* @param {Date} date
* @param {Number} number
* @param {String} timeKey
* @returns {Date}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "subtract",
value: function subtract(date, number, timeKey) {
return external_moment_default()(date).locale(this.lang).subtract(number, timeKey).toDate();
}
/**
* Get Number of Day in A month from A Date
*
* @param {Date} date
* @returns {Number}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "daysInMonth",
value: function daysInMonth(date) {
return external_moment_default()(date).daysInMonth();
}
/**
* Get Day 0 - 6 from A Date
*
* @param {Date} date
* @returns {Number}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "day",
value: function day(date) {
return external_moment_default()(date).day();
}
/**
* Get Month 0 - 11 from A Date
*
* @param {Date} date
* @returns {Number}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "month",
value: function month(date) {
return external_moment_default()(date).month();
}
/**
* Get Year from A Date
* @param {Date} date
* @returns {Number}
*/
// eslint-disable-next-line class-methods-use-this
}, {
key: "year",
value: function year(date) {
return external_moment_default()(date).year();
}
}]);
return _default;
}();
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/Components/DateInput.vue?vue&type=template&id=03bc52d6
var DateInputvue_type_template_id_03bc52d6_hoisted_1 = ["id", "type", "name", "placeholder", "required", "value"];
function DateInputvue_type_template_id_03bc52d6_render(_ctx, _cache, $props, $setup, $data, $options) {
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("div", null, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("input", {
id: $props.id,
type: $props.type,
ref: $props.refName,
name: $props.name,
placeholder: $props.placeholder,
required: $props.required,
value: $options.formattedValue,
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)($props.inputClass),
onClick: _cache[0] || (_cache[0] = function () {
return $options.onClick && $options.onClick.apply($options, arguments);
}),
readonly: ""
}, null, 10 /* CLASS, PROPS */, DateInputvue_type_template_id_03bc52d6_hoisted_1)]);
}
;// CONCATENATED MODULE: ./src/Components/DateInput.vue?vue&type=template&id=03bc52d6
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/Components/DateInput.vue?vue&type=script&lang=js
/* harmony default export */ const DateInputvue_type_script_lang_js = ({
props: {
inputClass: [String, Object, Array],
refName: String,
name: String,
type: String,
placeholder: String,
id: String,
required: Boolean,
format: String,
sameDateFormat: Object,
language: String,
selectedStartDate: Date,
selectedEndDate: Date
},
emits: ['on-click'],
computed: {
dateUtil: function dateUtil() {
return new _default(this.language);
},
formattedValue: function formattedValue() {
if (!this.selectedStartDate || !this.selectedEndDate) return '';
if (this.dateUtil.isSameDate(this.selectedStartDate, this.selectedEndDate)) {
var _date = this.dateUtil.formatDate(this.selectedStartDate, this.sameDateFormat.from);
var _date2 = this.dateUtil.formatDate(this.selectedEndDate, this.sameDateFormat.to);
return "".concat(_date, " - ").concat(_date2);
}
var date1 = this.dateUtil.formatDate(this.selectedStartDate, this.format);
var date2 = this.dateUtil.formatDate(this.selectedEndDate, this.format);
return "".concat(date1, " - ").concat(date2);
}
},
methods: {
onClick: function onClick() {
this.$emit('on-click', true);
}
}
});
;// CONCATENATED MODULE: ./src/Components/DateInput.vue?vue&type=script&lang=js
// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
var exportHelper = __webpack_require__(744);
;// CONCATENATED MODULE: ./src/Components/DateInput.vue
;
const __exports__ = /*#__PURE__*/(0,exportHelper["default"])(DateInputvue_type_script_lang_js, [['render',DateInputvue_type_template_id_03bc52d6_render]])
/* harmony default export */ const DateInput = (__exports__);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/Components/CalendarDialog.vue?vue&type=template&id=65ac0926
var CalendarDialogvue_type_template_id_65ac0926_hoisted_1 = {
key: 0,
"class": "vdpr-datepicker__calendar-button-helper"
};
var _hoisted_2 = ["onClick"];
var _hoisted_3 = {
"class": "vdpr-datepicker__calendar-actions"
};
var _hoisted_4 = {
"class": "vdpr-datepicker__calendar-input-wrapper"
};
var _hoisted_5 = {
"class": "vdpr-datepicker__calendar-input-wrapper"
};
var _hoisted_6 = {
"class": "vdpr-datepicker__calendar-input-wrapper vdpr-datepicker__calendar-input-wrapper--end"
};
var _hoisted_7 = {
"class": "vdpr-datepicker__calendar-input-wrapper"
};
var _hoisted_8 = {
"class": "vdpr-datepicker__calendar-input-wrapper vdpr-datepicker__calendar-input-wrapper--end"
};
function CalendarDialogvue_type_template_id_65ac0926_render(_ctx, _cache, $props, $setup, $data, $options) {
var _component_calendar = (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.resolveComponent)("calendar");
var _component_switch_button = (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.resolveComponent)("switch-button");
var _component_calendar_input_date = (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.resolveComponent)("calendar-input-date");
var _component_calendar_input_time = (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.resolveComponent)("calendar-input-time");
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("div", {
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)(["vdpr-datepicker__calendar-dialog", {
'vdpr-datepicker__calendar-dialog--inline': this.inline
}])
}, [$options.helpers.length ? ((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("div", CalendarDialogvue_type_template_id_65ac0926_hoisted_1, [((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.renderList)($options.helpers, function (btn) {
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("button", {
key: 'btn' + btn.name,
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)(['vdpr-datepicker__button', 'vdpr-datepicker__button--block', 'vdpr-datepicker__button-default']),
onClick: function onClick() {
$options.onHelperClick(btn.from, btn.to);
}
}, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)(btn.name), 9 /* TEXT, PROPS */, _hoisted_2);
}), 128 /* KEYED_FRAGMENT */))])) : (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createCommentVNode)("v-if", true), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_calendar, {
language: $props.language,
selectedStartDate: $data.selectedStartDate,
selectedEndDate: $data.selectedEndDate,
disabledDates: $props.disabledDates,
availableDates: $props.availableDates,
isMondayFirst: $props.isMondayFirst,
onSelectDate: $options.selectDate,
onSelectDisabledDate: $options.selectDisabledDate,
onOnPrevCalendar: $options.onPrevCalendar,
onOnNextCalendar: $options.onNextCalendar
}, null, 8 /* PROPS */, ["language", "selectedStartDate", "selectedEndDate", "disabledDates", "availableDates", "isMondayFirst", "onSelectDate", "onSelectDisabledDate", "onOnPrevCalendar", "onOnNextCalendar"]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", _hoisted_3, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", _hoisted_4, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("span", null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)($props.switchButtonLabel), 1 /* TEXT */), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_switch_button, {
checked: $data.isAllDay,
onOnCheckChange: $options.onCheckChange
}, null, 8 /* PROPS */, ["checked", "onOnCheckChange"])]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", _hoisted_5, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("span", null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)($props.dateInput.labelStarts), 1 /* TEXT */), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_calendar_input_date, {
format: $props.dateInput.format,
inputClass: $props.dateInput.inputClass,
timestamp: $options.unixSelectedStartDate,
language: $props.language,
onOnChange: $options.onStartInputDateChange
}, null, 8 /* PROPS */, ["format", "inputClass", "timestamp", "language", "onOnChange"])]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", _hoisted_6, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.withDirectives)((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_calendar_input_time, {
step: $props.timeInput.step,
readonly: $props.timeInput.readonly,
inputClass: $props.timeInput.inputClass,
timestamp: $options.unixSelectedStartDate,
onOnChange: $options.onTimeStartInputChange
}, null, 8 /* PROPS */, ["step", "readonly", "inputClass", "timestamp", "onOnChange"]), [[external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.vShow, $options.isVisibleTimeInput]])]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", _hoisted_7, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("span", null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)($props.dateInput.labelEnds), 1 /* TEXT */), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_calendar_input_date, {
format: $props.dateInput.format,
inputClass: $props.dateInput.inputClass,
timestamp: $options.unixSelectedEndDate,
language: $props.language,
onOnChange: $options.onEndDateInputDateChange
}, null, 8 /* PROPS */, ["format", "inputClass", "timestamp", "language", "onOnChange"])]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", _hoisted_8, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.withDirectives)((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createVNode)(_component_calendar_input_time, {
step: $props.timeInput.step,
readonly: $props.timeInput.readonly,
inputClass: $props.timeInput.inputClass,
timestamp: $options.unixSelectedEndDate,
onOnChange: $options.onTimeEndInputChange
}, null, 8 /* PROPS */, ["step", "readonly", "inputClass", "timestamp", "onOnChange"]), [[external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.vShow, $options.isVisibleTimeInput]])]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.withDirectives)((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("button", {
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)(['vdpr-datepicker__button', 'vdpr-datepicker__button--block', 'vdpr-datepicker__button-submit']),
onClick: _cache[0] || (_cache[0] = function () {
return $options.onClickButtonApply && $options.onClickButtonApply.apply($options, arguments);
})
}, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)($props.applyButtonLabel), 513 /* TEXT, NEED_PATCH */), [[external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.vShow, $options.isVisibleButtonApply]]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("button", {
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)(['vdpr-datepicker__button', 'vdpr-datepicker__button--block', 'vdpr-datepicker__button-reset']),
onClick: _cache[1] || (_cache[1] = function () {
return $options.onClickButtonReset && $options.onClickButtonReset.apply($options, arguments);
})
}, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)($props.resetButtonLabel), 1 /* TEXT */)])], 2 /* CLASS */);
}
;// CONCATENATED MODULE: ./src/Components/CalendarDialog.vue?vue&type=template&id=65ac0926
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/Components/Calendar.vue?vue&type=template&id=58f71eef
var Calendarvue_type_template_id_58f71eef_hoisted_1 = {
"class": "vdpr-datepicker__calendar"
};
var Calendarvue_type_template_id_58f71eef_hoisted_2 = {
"class": "vdpr-datepicker__calendar-control"
};
var Calendarvue_type_template_id_58f71eef_hoisted_3 = {
"class": "vdpr-datepicker__calendar-month-year"
};
var Calendarvue_type_template_id_58f71eef_hoisted_4 = {
"class": "vdpr-datepicker__calendar-table"
};
var Calendarvue_type_template_id_58f71eef_hoisted_5 = ["onClick"];
function Calendarvue_type_template_id_58f71eef_render(_ctx, _cache, $props, $setup, $data, $options) {
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("div", Calendarvue_type_template_id_58f71eef_hoisted_1, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("div", Calendarvue_type_template_id_58f71eef_hoisted_2, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("span", {
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)(["vdpr-datepicker__calendar-control-prev", {
'vdpr-datepicker__calendar-control-disabled': $options.isPrevDisabled
}]),
onClick: _cache[0] || (_cache[0] = function () {
return $options.onPrevClick && $options.onPrevClick.apply($options, arguments);
})
}, null, 2 /* CLASS */), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("span", Calendarvue_type_template_id_58f71eef_hoisted_3, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)($options.monthYear), 1 /* TEXT */), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("span", {
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)(["vdpr-datepicker__calendar-control-next", {
'vdpr-datepicker__calendar-control-disabled': $options.isNextDisabled
}]),
onClick: _cache[1] || (_cache[1] = function () {
return $options.onNextClick && $options.onNextClick.apply($options, arguments);
})
}, null, 2 /* CLASS */)]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("table", Calendarvue_type_template_id_58f71eef_hoisted_4, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("thead", null, [(0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("tr", null, [((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.renderList)($options.dayNames, function (dayName) {
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("th", {
key: dayName
}, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)(dayName), 1 /* TEXT */);
}), 128 /* KEYED_FRAGMENT */))])]), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("tbody", null, [((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.renderList)(6, function (row) {
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementVNode)("tr", {
key: row
}, [((0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.renderList)($options.getRowDays(row), function (day) {
return (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.createElementBlock)("td", {
key: day.timestamp,
"class": (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.normalizeClass)({
highlighted: day.isBetween || day.isStartDate || day.isEndDate,
faded: day.isFaded,
disabled: day.isDisabled
}),
onClick: function onClick($event) {
return $options.selectDate(day);
}
}, (0,external_commonjs_vue_commonjs2_vue_amd_vue_root_Vue_.toDisplayString)(day.dateNumber), 11 /* TEXT, CLASS, PROPS */, Calendarvue_type_template_id_58f71eef_hoisted_5);
}), 128 /* KEYED_FRAGMENT */))]);
}), 64 /* STABLE_FRAGMENT */))])])]);
}
;// CONCATENATED MODULE: ./src/Components/Calendar.vue?vue&type=template&id=58f71eef
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[1].rules[6].use[0]!./src/Components/Calendar.vue?vue&type=script&lang=js
function Calendarvue_type_script_lang_js_typeof(obj) { "@babel/helpers - typeof"; return Calendarvue_type_script_lang_js_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, Calendarvue_type_script_lang_js_typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || Calendarvue_type_script_lang_js_unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Calendarvue_type_script_lang_js_arrayLikeToArray(arr); }
function _toArray(arr) { return Calendarvue_type_script_lang_js_arrayWithHoles(arr) || _iterableToArray(arr) || Calendarvue_type_script_lang_js_unsupportedIterableToArray(arr) || Calendarvue_type_script_lang_js_nonIterableRest(); }
function Calendarvue_type_script_lang_js_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function Calendarvue_type_script_lang_js_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Calendarvue_type_script_lang_js_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Calendarvue_type_script_lang_js_arrayLikeToArray(o, minLen); }
function Calendarvue_type_script_lang_js_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function Calendarvue_type_script_lang_js_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function Calendarvue_type_script_lang_js_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, Calendarvue_type_script_lang_js_toPropertyKey(descriptor.key), descriptor); } }
function Calendarvue_type_script_lang_js_createClass(Constructor, protoProps, staticProps) { if (protoProps) Calendarvue_type_script_lang_js_defineProperties(Constructor.prototype, protoProps); if (staticProps) Calendarvue_type_script_lang_js_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function Calendarvue_type_script_lang_js_toPropertyKey(arg) { var key = Calendarvue_type_script_lang_js_toPrimitive(arg, "string"); return Calendarvue_type_script_lang_js_typeof(key) === "symbol" ? key : String(key); }
function Calendarvue_type_script_lang_js_toPrimitive(input, hint) { if (Calendarvue_type_script_lang_js_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (Calendarvue_type_script_lang_js_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function Calendarvue_type_script_lang_js_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Day = /*#__PURE__*/Calendarvue_type_script_lang_js_createClass(function Day(date, isBetween, isStartDate, isEndDate, isDisabled, isFaded) {
Calendarvue_type_script_lang_js_classCallCheck(this, Day);
this.date = date;
this.timestamp = date.getTime();
this.dateNumber = date.getDate();
this.isBetween = isBetween;
this.isStartDate = isStartDate;
this.isEndDate = isEndDate;
this.isDisabled = isDisabled;
this.isFaded = isFaded;
});
/* harmony default export */ const Calendarvue_type_script_lang_js = ({
props: {
selectedStartDate: Date,
selectedEndDate: Date,
language: String,
disabledDates: Object,
availableDates: Object,
isMondayFirst: Boolean
},
data: function data() {
var _ref, _this$selectedStartDa;
var dateUtil = new _default(this.language);
var startDate = (_ref = (_this$selectedStartDa = this.selectedStartDate) !== null && _this$selectedStartDa !== void 0 ? _this$selectedStartDa : this.selectedEndDate) !== null && _ref !== void 0 ? _ref : new Date();
var pageTimestamp = dateUtil.toUnix(dateUtil.startOf(startDate, 'month'));
return {
// stored page time stamp start of a month
pageTimestamp: pageTimestamp
};
},
emits: ['select-disabled-date', 'select-date', 'on-prev-calendar', 'on-next-calendar'],
computed: {
dateUtil: function dateUtil() {
return new _default(this.language);
},
dayNames: function dayNames() {
var dayNames = this.dateUtil.getAbbrDayNames();
if (this.isMondayFirst) {
var _dayNames = _toArray(dayNames),
sunday = _dayNames[0],
restOfDays = _dayNames.slice(1);
return [].concat(_toConsumableArray(restOfDays), [sunday]);
}
return dayNames;
},
monthYear: function monthYear() {
var pageDate = this.dateUtil.fromUnix(this.pageTimestamp);
return this.dateUtil.formatDate(pageDate, 'MMM YYYY');
},
days: function days() {
var pageDate = this.dateUtil.fromUnix(this.pageTimestamp);
var daysInMonth = this.dateUtil.daysInMonth(pageDate);
var days = [];
var preDays = [];
var postDays = [];
for (var i = 0; i < daysInMonth; i += 1) {
days.push(this.constructDay(pageDate, false));
pageDate = this.dateUtil.add(pageDate, 1, 'd');
}
var firstDay = days[0].date;
var SUNDAY = 0;
var MONDAY = 1;
var threshold = this.isMondayFirst ? MONDAY : SUNDAY;
while (firstDay.getDay() !== threshold) {
firstDay = this.dateUtil.subtract(firstDay, 1, 'd');
preDays.unshift(this.constructDay(firstDay, true));
}
var lastDay = days[days.length - 1].date;
for (var k = preDays.length + days.length; k < 42; k += 1) {
lastDay = this.dateUtil.add(lastDay, 1, 'd');
postDays.push(this.constructDay(lastDay, true));
}
return [].concat(preDays, days, postDays);
},
isNextDisabled: function isNextDisabled() {
if (this.disabledDates && this.disabledDates.from) {
var _this$disabledDates = this.disabledDates,
from = _this$disabledDates.from,
to = _this$disabledDates.to;
// next is always available if there's 'to' date intersecting 'from' date
if (to && this.dateUtil.isAfter(to, from)) {
return false;
}
var pageDate = this.dateUtil.fromUnix(this.pageTimestamp);
return this.dateUtil.month(from) <= this.dateUtil.month(pageDate) && this.dateUtil.year(from) <= this.dateUtil.year(pageDate) || this.dateUtil.year(from) < this.dateUtil.year(pageDate);
}
// availableDates cannot interfere disabledDates
if (Util.isEmptyObject(this.disabledDates) && this.availableDates && this.availableDates.to) {
var _this$availableDates = this.availableDates,
_from = _this$availableDates.from,
_to = _this$availableDates.to;
// next is always available if there's 'from' date intersecting 'to' date
if (_from && this.dateUtil.isAfter(_from, _to)) {
return false;
}
var _pageDate = this.dateUtil.fromUnix(this.pageTimestamp);
return this.dateUtil.month(_to) <= this.dateUtil.month(_pageDate) && this.dateUtil.year(_to) <= this.dateUtil.year(_pageDate) || this.dateUtil.year(_to) < this.dateUtil.year(_pageDate);
}
return false;
},
isPrevDisabled: function isPrevDisabled() {
if (this.disabledDates && this.disabledDates.to) {
var _this$disabledDates2 = this.disabledDates,
from = _this$disabledDates2.from,
to = _this$disabledDates2.to;
// prev is always available if there's 'from' date intersecting 'to' date
if (from && this.dateUtil.isBefore(from, to)) {
return false;
}
var pageDate = this.dateUtil.fromUnix(this.pageTimestamp);
return this.dateUtil.month(to) >= this.dateUtil.month(pageDate) && this.dateUtil.year(to) >= this.dateUtil.year(pageDate) || this.dateUtil.year(to) > this.dateUtil.year(pageDate);
}
// availableDates cannot interfere disabledDates
if (Util.isEmptyObject(this.disabledDates) && this.availabl