Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-year-calendar

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-year-calendar - npm Package Compare versions

Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3

dist/rc-year-calendar.css

2

dist/rc-year-calendar.min.js

@@ -1,1 +0,1 @@

"use strict";function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var React=_interopDefault$1(require("react")),PropTypes=_interopDefault$1(require("prop-types"));function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var jsYearCalendar=createCommonjsModule(function(e,t){!function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=function(){function D(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,D),s(this,"element",void 0),s(this,"options",void 0),s(this,"_dataSource",void 0),s(this,"_mouseDown",void 0),s(this,"_rangeStart",void 0),s(this,"_rangeEnd",void 0),s(this,"_responsiveInterval",void 0),s(this,"clickDay",void 0),s(this,"dayContextMenu",void 0),s(this,"mouseOnDay",void 0),s(this,"mouseOutDay",void 0),s(this,"renderEnd",void 0),s(this,"selectRange",void 0),s(this,"yearChanged",void 0),e instanceof HTMLElement)this.element=e;else{if("string"!=typeof e)throw new Error("The element parameter should be a DOM node or a selector");this.element=document.querySelector(e)}this.element.classList.add("calendar"),this._initializeEvents(t),this._initializeOptions(t),this.setYear(this.options.startYear)}return e=D,(t=[{key:"_initializeOptions",value:function(e){null==e&&(e={}),this.options={startYear:isNaN(parseInt(e.startYear))?(new Date).getFullYear():parseInt(e.startYear),minDate:e.minDate instanceof Date?e.minDate:null,maxDate:e.maxDate instanceof Date?e.maxDate:null,language:null!=e.language&&null!=D.locales[e.language]?e.language:"en",allowOverlap:null==e.allowOverlap||e.allowOverlap,displayWeekNumber:null!=e.displayWeekNumber&&e.displayWeekNumber,displayDisabledDataSource:null!=e.displayDisabledDataSource&&e.displayDisabledDataSource,displayHeader:null==e.displayHeader||e.displayHeader,alwaysHalfDay:null!=e.alwaysHalfDay&&e.alwaysHalfDay,enableRangeSelection:null!=e.enableRangeSelection&&e.enableRangeSelection,disabledDays:e.disabledDays instanceof Array?e.disabledDays:[],disabledWeekDays:e.disabledWeekDays instanceof Array?e.disabledWeekDays:[],hiddenWeekDays:e.hiddenWeekDays instanceof Array?e.hiddenWeekDays:[],roundRangeLimits:null!=e.roundRangeLimits&&e.roundRangeLimits,dataSource:e.dataSource instanceof Array||"function"==typeof e.dataSource?e.dataSource:[],style:"background"==e.style||"border"==e.style||"custom"==e.style?e.style:"border",enableContextMenu:null!=e.enableContextMenu&&e.enableContextMenu,contextMenuItems:e.contextMenuItems instanceof Array?e.contextMenuItems:[],customDayRenderer:"function"==typeof e.customDayRenderer?e.customDayRenderer:null,customDataSourceRenderer:"function"==typeof e.customDataSourceRenderer?e.customDataSourceRenderer:null,weekStart:isNaN(parseInt(e.weekStart))?null:parseInt(e.weekStart),loadingTemplate:"string"==typeof e.loadingTemplate||e.loadingTemplate instanceof HTMLElement?e.loadingTemplate:null},this.options.dataSource instanceof Array&&(this._dataSource=this.options.dataSource,this._initializeDatasourceColors())}},{key:"_initializeEvents",value:function(e){null==e&&(e=[]),e.yearChanged&&this.element.addEventListener("yearChanged",e.yearChanged),e.renderEnd&&this.element.addEventListener("renderEnd",e.renderEnd),e.clickDay&&this.element.addEventListener("clickDay",e.clickDay),e.dayContextMenu&&this.element.addEventListener("dayContextMenu",e.dayContextMenu),e.selectRange&&this.element.addEventListener("selectRange",e.selectRange),e.mouseOnDay&&this.element.addEventListener("mouseOnDay",e.mouseOnDay),e.mouseOutDay&&this.element.addEventListener("mouseOutDay",e.mouseOutDay)}},{key:"_fetchDataSource",value:function(e){if("function"==typeof this.options.dataSource){var t=this.options.dataSource;if(2==t.length)t(this.options.startYear,e);else{var n=t(this.options.startYear);n instanceof Array?e(n):n.then(e)}}else e(this.options.dataSource)}},{key:"_initializeDatasourceColors",value:function(){for(var e=0;e<this._dataSource.length;e++)null==this._dataSource[e].color&&(this._dataSource[e].color=D.colors[e%D.colors.length])}},{key:"render",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.element.firstChild;)this.element.removeChild(this.element.firstChild);if(this.options.displayHeader&&this._renderHeader(),e)this._renderLoading();else{this._renderBody(),this._renderDataSource(),this._applyEvents();var t=this.element.querySelector(".months-container");t.style.opacity="0",t.style.display="block",t.style.transition="opacity 0.5s",setTimeout(function(){t.style.opacity="1",setTimeout(function(){return t.style.transition=""},500)},0),this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function(){var e=document.createElement("div");e.classList.add("calendar-header");var t=document.createElement("table"),n=document.createElement("th");n.classList.add("prev"),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&n.classList.add("disabled");var a=document.createElement("span");a.innerHTML="&lsaquo;",n.appendChild(a),t.appendChild(n);var s=document.createElement("th");s.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),s.textContent=(this.options.startYear-2).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-2,11,31)&&s.classList.add("disabled"),t.appendChild(s);var r=document.createElement("th");r.classList.add("year-title","year-neighbor","hidden-xs"),r.textContent=(this.options.startYear-1).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&r.classList.add("disabled"),t.appendChild(r);var o=document.createElement("th");o.classList.add("year-title"),o.textContent=this.options.startYear.toString(),t.appendChild(o);var i=document.createElement("th");i.classList.add("year-title","year-neighbor","hidden-xs"),i.textContent=(this.options.startYear+1).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&i.classList.add("disabled"),t.appendChild(i);var l=document.createElement("th");l.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),l.textContent=(this.options.startYear+2).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+2,0,1)&&l.classList.add("disabled"),t.appendChild(l);var d=document.createElement("th");d.classList.add("next"),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&d.classList.add("disabled");var u=document.createElement("span");u.innerHTML="&rsaquo;",d.appendChild(u),t.appendChild(d),e.appendChild(t),this.element.appendChild(e)}},{key:"_renderBody",value:function(){var e=document.createElement("div");e.classList.add("months-container");for(var t=0;t<12;t++){var n=document.createElement("div");n.classList.add("month-container"),n.dataset.monthId=t.toString();var a=new Date(this.options.startYear,t,1),s=document.createElement("table");s.classList.add("month");var r=document.createElement("thead"),o=document.createElement("tr"),i=document.createElement("th");i.classList.add("month-title"),i.setAttribute("colspan",this.options.displayWeekNumber?"8":"7"),i.textContent=D.locales[this.options.language].months[t],o.appendChild(i),r.appendChild(o);var l=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("th");d.classList.add("week-number"),d.textContent=D.locales[this.options.language].weekShort,l.appendChild(d)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart,c=u;do{var p=document.createElement("th");p.classList.add("day-header"),p.textContent=D.locales[this.options.language].daysMin[c],this._isHidden(c)&&p.classList.add("hidden"),l.appendChild(p),7<=++c&&(c=0)}while(c!=u);r.appendChild(l),s.appendChild(r);for(var h=new Date(a.getTime()),y=new Date(this.options.startYear,t+1,0);h.getDay()!=u;)h.setDate(h.getDate()-1);for(;h<=y;){var f=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("td"),m=new Date(h.getTime());m.setDate(m.getDate()-u+4),d.classList.add("week-number"),d.textContent=this.getWeekNumber(m).toString(),f.appendChild(d)}do{var g=document.createElement("td");if(g.classList.add("day"),this._isHidden(h.getDay())&&g.classList.add("hidden"),h<a)g.classList.add("old");else if(y<h)g.classList.add("new");else{this._isDisabled(h)&&g.classList.add("disabled");var v=document.createElement("div");v.classList.add("day-content"),v.textContent=h.getDate().toString(),g.appendChild(v),this.options.customDayRenderer&&this.options.customDayRenderer(v,h)}f.appendChild(g),h.setDate(h.getDate()+1)}while(h.getDay()!=u);s.appendChild(f)}n.appendChild(s),e.appendChild(n)}this.element.appendChild(e)}},{key:"_renderLoading",value:function(){var e=document.createElement("div");if(e.classList.add("calendar-loading"),this.options.loadingTemplate)"string"==typeof this.options.loadingTemplate?e.innerHTML=this.options.loadingTemplate:this.options.loadingTemplate instanceof HTMLElement&&e.appendChild(this.options.loadingTemplate);else{var t=document.createElement("div");t.classList.add("calendar-spinner");for(var n=1;n<=3;n++){var a=document.createElement("div");a.classList.add("bounce".concat(n)),t.appendChild(a)}e.appendChild(t)}this.element.appendChild(e)}},{key:"_renderDataSource",value:function(){var i=this;null!=this._dataSource&&0<this._dataSource.length&&this.element.querySelectorAll(".month-container").forEach(function(e){var r=parseInt(e.dataset.monthId),t=new Date(i.options.startYear,r,1),n=new Date(i.options.startYear,r+1,1);if((null==i.options.minDate||n>i.options.minDate)&&(null==i.options.maxDate||t<=i.options.maxDate)){for(var o=[],a=0;a<i._dataSource.length;a++)i._dataSource[a].startDate>=n&&!(i._dataSource[a].endDate<t)||o.push(i._dataSource[a]);0<o.length&&e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(i.options.startYear,r,parseInt(e.textContent)),n=new Date(i.options.startYear,r,t.getDate()+1),a=[];if((null==i.options.minDate||t>=i.options.minDate)&&(null==i.options.maxDate||t<=i.options.maxDate)){for(var s=0;s<o.length;s++)o[s].startDate<n&&o[s].endDate>=t&&a.push(o[s]);0<a.length&&(i.options.displayDisabledDataSource||!i._isDisabled(t))&&i._renderDataSourceDay(e,t,a)}})}})}},{key:"_renderDataSourceDay",value:function(e,t,n){var a=e.parentElement;switch(this.options.style){case"border":var s=0;if(1==n.length?s=4:n.length<=3?s=2:a.style.boxShadow="inset 0 -4px 0 0 black",0<s){for(var r="",o=0;o<n.length;o++)""!=r&&(r+=","),r+="inset 0 -".concat((o+1)*s,"px 0 0 ").concat(n[o].color);a.style.boxShadow=r}break;case"background":a.style.backgroundColor=n[n.length-1].color;var i=t.getTime();if(n[n.length-1].startDate.getTime()==i)if(a.classList.add("day-start"),n[n.length-1].startHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].startDate.getTime()!=i||!n[o].startHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(-45deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-left");else if(n[n.length-1].endDate.getTime()==i)if(a.classList.add("day-end"),n[n.length-1].endHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].endDate.getTime()!=i||!n[o].endHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(135deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-right");break;case"custom":this.options.customDataSourceRenderer&&this.options.customDataSourceRenderer.call(this,e,t,n)}}},{key:"_applyEvents",value:function(){var r=this;this.options.displayHeader&&(this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){e.currentTarget.classList.contains("disabled")||r.setYear(parseInt(e.currentTarget.textContent))})}),this.element.querySelector(".calendar-header .prev").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=r.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){r.setYear(r.options.startYear-1)},50)},100)}}),this.element.querySelector(".calendar-header .next").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=r.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="-100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){r.setYear(r.options.startYear+1)},50)},100)}}));var e=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");e.forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation();var t=r._getDate(e.currentTarget);r._triggerEvent("clickDay",{element:e.currentTarget,date:t,events:r.getEvents(t)})}),e.addEventListener("contextmenu",function(e){r.options.enableContextMenu&&(e.preventDefault(),0<r.options.contextMenuItems.length&&r._openContextMenu(e.currentTarget));var t=r._getDate(e.currentTarget);r._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:r.getEvents(t)})}),r.options.enableRangeSelection&&(e.addEventListener("mousedown",function(e){if(1==e.which){var t=r._getDate(e.currentTarget);(r.options.allowOverlap||0==r.getEvents(t).length)&&(r._mouseDown=!0,r._rangeStart=r._rangeEnd=t,r._refreshRange())}}),e.addEventListener("mouseenter",function(e){if(r._mouseDown){var t=r._getDate(e.currentTarget);if(!r.options.allowOverlap){var n=new Date(r._rangeStart.getTime());if(n<t)for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);n<t&&!(0<r.getEvents(a).length);)n.setDate(n.getDate()+1),a.setDate(a.getDate()+1);else for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);t<n&&!(0<r.getEvents(a).length);)n.setDate(n.getDate()-1),a.setDate(a.getDate()-1);t=n}var s=r._rangeEnd;r._rangeEnd=t,s.getTime()!=r._rangeEnd.getTime()&&r._refreshRange()}})),e.addEventListener("mouseenter",function(e){if(!r._mouseDown){var t=r._getDate(e.currentTarget);r._triggerEvent("mouseOnDay",{element:e.currentTarget,date:t,events:r.getEvents(t)})}}),e.addEventListener("mouseleave",function(e){var t=r._getDate(e.currentTarget);r._triggerEvent("mouseOutDay",{element:e.currentTarget,date:t,events:r.getEvents(t)})})}),this.options.enableRangeSelection&&window.addEventListener("mouseup",function(e){if(r._mouseDown){r._mouseDown=!1,r._refreshRange();var t=r._rangeStart<r._rangeEnd?r._rangeStart:r._rangeEnd,n=r._rangeEnd>r._rangeStart?r._rangeEnd:r._rangeStart;r._triggerEvent("selectRange",{startDate:t,endDate:n,events:r.getEventsOnRange(t,new Date(n.getFullYear(),n.getMonth(),n.getDate()+1))})}}),this._responsiveInterval&&(clearInterval(this._responsiveInterval),this._responsiveInterval=null),this._responsiveInterval=setInterval(function(){var e=r.element.offsetWidth,t=r.element.querySelector(".month").offsetWidth+10,n=null;n=6*t<e?2:4*t<e?3:3*t<e?4:2*t<e?6:12,r.element.querySelectorAll(".month-container").forEach(function(e){e.classList.contains("month-".concat(n))||(e.classList.remove("month-2","month-3","month-4","month-6","month-12"),e.classList.add("month-".concat(n)))})},300)}},{key:"_refreshRange",value:function(){var n=this;if(this.element.querySelectorAll("td.day.range").forEach(function(e){return e.classList.remove("range")}),this.element.querySelectorAll("td.day.range-start").forEach(function(e){return e.classList.remove("range-start")}),this.element.querySelectorAll("td.day.range-end").forEach(function(e){return e.classList.remove("range-end")}),this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd,s=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);a.getMonth()<=t&&s.getMonth()>=t&&e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);a<=t&&t<=s&&(e.classList.add("range"),t.getTime()==a.getTime()&&e.classList.add("range-start"),t.getTime()==s.getTime()&&e.classList.add("range-end"))})})}}},{key:"_openContextMenu",value:function(e){var t=document.querySelector(".calendar-context-menu");if(null!==t)for(t.style.display="none";t.firstChild;)t.removeChild(t.firstChild);else(t=document.createElement("div")).classList.add("calendar-context-menu"),document.body.appendChild(t);for(var n=this._getDate(e),a=this.getEvents(n),s=0;s<a.length;s++){var r=document.createElement("div");r.classList.add("item"),r.style.borderLeft="4px solid ".concat(a[s].color);var o=document.createElement("div");o.classList.add("content"),o.textContent=a[s].name,r.appendChild(o);var i=document.createElement("span");i.innerHTML="&rsaquo;",r.appendChild(i),this._renderContextMenuItems(r,this.options.contextMenuItems,a[s]),t.appendChild(r)}0<t.children.length&&(t.style.left=e.offsetLeft+25+"px",t.style.top=e.offsetTop+25+"px",t.style.display="block",window.addEventListener("mouseup",function(){t.style.display="none"},{once:!0}))}},{key:"_renderContextMenuItems",value:function(e,t,n){var a=document.createElement("div");a.classList.add("submenu");for(var s=0;s<t.length;s++)if(!1!==t[s].visible&&("function"!=typeof t[s].visible||t[s].visible(n))){var r=document.createElement("div");r.classList.add("item");var o=document.createElement("div");o.classList.add("content"),o.textContent=t[s].text,r.appendChild(o),t[s].click&&function(e){r.addEventListener("click",function(){t[e].click(n)})}(s);var i=document.createElement("span");i.innerHTML="&rsaquo;",r.appendChild(i),t[s].items&&0<t[s].items.length&&this._renderContextMenuItems(r,t[s].items,n),a.appendChild(r)}0<a.children.length&&e.appendChild(a)}},{key:"_getDate",value:function(e){var t=e.querySelector(":scope > .day-content").textContent,n=e.closest(".month-container").dataset.monthId,a=this.options.startYear;return new Date(a,n,t)}},{key:"_triggerEvent",value:function(e,t){var n=new Event(e);for(var a in n.calendar=this,t)n[a]=t[a];return this.element.dispatchEvent(n),n}},{key:"_isDisabled",value:function(e){if(null!=this.options.minDate&&e<this.options.minDate||null!=this.options.maxDate&&e>this.options.maxDate)return!0;if(0<this.options.disabledWeekDays.length)for(var t=0;t<this.options.disabledWeekDays.length;t++)if(e.getDay()==this.options.disabledWeekDays[t])return!0;if(0<this.options.disabledDays.length)for(var t=0;t<this.options.disabledDays.length;t++)if(e.getTime()==this.options.disabledDays[t].getTime())return!0;return!1}},{key:"_isHidden",value:function(e){if(0<this.options.hiddenWeekDays.length)for(var t=0;t<this.options.hiddenWeekDays.length;t++)if(e==this.options.hiddenWeekDays[t])return!0;return!1}},{key:"getWeekNumber",value:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)}},{key:"getEvents",value:function(e){return this.getEventsOnRange(e,new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))}},{key:"getEventsOnRange",value:function(e,t){var n=[];if(this._dataSource&&e&&t)for(var a=0;a<this._dataSource.length;a++)this._dataSource[a].startDate<t&&this._dataSource[a].endDate>=e&&n.push(this._dataSource[a]);return n}},{key:"getYear",value:function(){return this.options.startYear}},{key:"setYear",value:function(e){var t=this,n=parseInt(e);if(!isNaN(n)){for(this.options.startYear=n;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.options.displayHeader&&this._renderHeader();var a=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:!1});"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):a.preventRendering||this.render()}}},{key:"getMinDate",value:function(){return this.options.minDate}},{key:"setMinDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.minDate=e,t||this.render())}},{key:"getMaxDate",value:function(){return this.options.maxDate}},{key:"setMaxDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.maxDate=e,t||this.render())}},{key:"getStyle",value:function(){return this.options.style}},{key:"setStyle",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.style="background"==e||"border"==e||"custom"==e?e:"border",t||this.render()}},{key:"getAllowOverlap",value:function(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function(e){this.options.allowOverlap=e}},{key:"getDisplayWeekNumber",value:function(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayWeekNumber=e,t||this.render()}},{key:"getDisplayHeader",value:function(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayHeader=e,t||this.render()}},{key:"getDisplayDisabledDataSource",value:function(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayDisabledDataSource=e,t||this.render()}},{key:"getAlwaysHalfDay",value:function(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.alwaysHalfDay=e,t||this.render()}},{key:"getEnableRangeSelection",value:function(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableRangeSelection=e,t||this.render()}},{key:"getDisabledDays",value:function(){return this.options.disabledDays}},{key:"setDisabledDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledDays=e instanceof Array?e:[],t||this.render()}},{key:"getDisabledWeekDays",value:function(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getHiddenWeekDays",value:function(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.hiddenWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getRoundRangeLimits",value:function(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.roundRangeLimits=e,t||this.render()}},{key:"getEnableContextMenu",value:function(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableContextMenu=e,t||this.render()}},{key:"getContextMenuItems",value:function(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.contextMenuItems=e instanceof Array?e:[],t||this.render()}},{key:"getCustomDayRenderer",value:function(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDayRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getCustomDataSourceRenderer",value:function(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDataSourceRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getLanguage",value:function(){return this.options.language}},{key:"setLanguage",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!=e&&null!=D.locales[e]&&(this.options.language=e,t||this.render())}},{key:"getDataSource",value:function(){return this.options.dataSource}},{key:"setDataSource",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.dataSource=e instanceof Array||"function"==typeof e?e:[],"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):(this._initializeDatasourceColors(),n||this.render())}},{key:"getWeekStart",value:function(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.weekStart=isNaN(parseInt(e))?null:parseInt(e),t||this.render()}},{key:"getLoadingTemplate",value:function(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function(e){this.options.loadingTemplate="string"==typeof e||e instanceof HTMLElement?e:null}},{key:"addEvent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this._dataSource.push(e),t||this.render()}}])&&a(e.prototype,t),n&&a(e,n),D;var e,t,n}();s(e.default=n,"locales",{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekShort:"W",weekStart:0}}),s(n,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),"object"===("undefined"==typeof window?"undefined":t(window))&&(window.Calendar=n,document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new n(e)})}))}(t)}),JsCalendar=unwrapExports(jsYearCalendar),Calendar=function(e){function t(e){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.JsCalendar=new JsCalendar(this.container,{allowOverlap:this.props.allowOverlap,alwaysHalfDay:this.props.alwaysHalfDay,contextMenuItems:this.props.contextMenuItems,customDayRenderer:this.props.customDayRenderer,customDataSourceRenderer:this.props.customDataSourceRenderer,dataSource:this.props.dataSource,disabledDays:this.props.disabledDays,disabledWeekDays:this.props.disabledWeekDays,displayDisabledDataSource:this.props.displayDisabledDataSource,displayHeader:this.props.displayHeader,displayWeekNumber:this.props.displayWeekNumber,enableContextMenu:this.props.enableContextMenu,enableRangeSelection:this.props.enableRangeSelection,hiddenWeekDays:this.props.hiddenWeekDays,language:this.props.language,loadingTemplate:this.props.loadingTemplate,maxDate:this.props.maxDate,minDate:this.props.minDate,roundRangeLimits:this.props.roundRangeLimits,style:this.props.style,weekStart:this.props.weekStart,startYear:null!=this.props.year?this.props.year:this.props.defaultYear,clickDay:this.props.onDayClick,dayContextMenu:this.props.onDayContextMenu,mouseOnDay:this.props.onDayEnter,mouseOutDay:this.props.onDayLeave,renderEnd:this.props.onRenderEnd,selectRange:this.props.onRangeSelected,yearChanged:this.props.onYearChanged})}},{key:"updateEvent",value:function(e,t,n){this.container.removeEventListener(e,t),this.container.addEventListener(e,n)}},{key:"componentWillReceiveProps",value:function(e){var t=this.JsCalendar,n=[];e.allowOverlap!=this.props.allowOverlap&&n.push(function(){return t.setAllowOverlap(e.allowOverlap,!1)}),e.alwaysHalfDay!=this.props.alwaysHalfDay&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!1)}),e.contextMenuItems!=this.props.contextMenuItems&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!1)}),e.customDayRenderer!=this.props.customDayRenderer&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!1)}),e.customDataSourceRenderer!=this.props.customDataSourceRenderer&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!1)}),e.dataSource!=this.props.dataSource&&n.push(function(){return t.setDataSource(e.dataSource,!1)}),e.disabledDays!=this.props.disabledDays&&n.push(function(){return t.setDisabledDays(e.disabledDays,!1)}),e.disabledWeekDays!=this.props.disabledWeekDays&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!1)}),e.displayDisabledDataSource!=this.props.displayDisabledDataSource&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!1)}),e.displayHeader!=this.props.displayHeader&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!1)}),e.displayWeekNumber!=this.props.displayWeekNumber&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!1)}),e.enableContextMenu!=this.props.enableContextMenu&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!1)}),e.enableRangeSelection!=this.props.enableRangeSelection&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!1)}),e.hiddenWeekDays!=this.props.hiddenWeekDays&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!1)}),e.language!=this.props.language&&n.push(function(){return t.setLanguage(e.language,!1)}),e.loadingTemplate!=this.props.loadingTemplate&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!1)}),e.maxDate!=this.props.maxDate&&n.push(function(){return t.setMaxDate(e.maxDate,!1)}),e.minDate!=this.props.minDate&&n.push(function(){return t.setMinDate(e.minDate,!1)}),e.roundRangeLimits!=this.props.roundRangeLimits&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!1)}),e.style!=this.props.style&&n.push(function(){return t.setStyle(e.style,!1)}),e.weekStart!=this.props.weekStart&&n.push(function(){return t.setWeekStart(e.weekStart,!1)}),e.year!=this.props.year&&n.push(function(){return t.setYear(e.year)}),e.onDayClick!=this.props.onDayClick&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),e.onDayContextMenu!=this.props.onDayContextMenu&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),e.onDayEnter!=this.props.onDayEnter&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),e.onDayLeave!=this.props.onDayLeave&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),e.onRenderEnd!=this.props.onRenderEnd&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),e.onRangeSelected!=this.props.onRangeSelected&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),e.onYearChanged!=this.props.onYearChanged&&this.updateEvent("yearChanged",this.props.onYearChanged,e.onYearChanged),0<n.length&&(n.forEach(function(e){return e()}),e.year==this.props.year&&t.render())}},{key:"render",value:function(){var t=this;return React.createElement("div",{ref:function(e){return t.container=e}})}}]),t}();_defineProperty(Calendar,"propsTypes",{allowOverlap:PropTypes.bool,alwaysHalfDay:PropTypes.bool,contextMenuItems:PropTypes.arrayOf(PropTypes.shape({text:PropTypes.string,click:PropTypes.func,visible:PropTypes.oneOfType([PropTypes.bool,PropTypes.func]),items:PropTypes.array})),customDayRenderer:PropTypes.func,customDataSourceRenderer:PropTypes.func,dataSource:PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({startDate:PropTypes.instanceOf(Date),endDate:PropTypes.instanceOf(Date),name:PropTypes.string})),PropTypes.func]),disabledDays:PropTypes.arrayOf(PropTypes.instanceOf(Date)),disabledWeekDays:PropTypes.arrayOf(PropTypes.number),displayDisabledDataSource:PropTypes.bool,displayHeader:PropTypes.bool,displayWeekNumber:PropTypes.bool,enableContextMenu:PropTypes.bool,enableRangeSelection:PropTypes.bool,hiddenWeekDays:PropTypes.arrayOf(PropTypes.number),language:PropTypes.string,loadingTemplate:PropTypes.string,maxDate:PropTypes.instanceOf(Date),minDate:PropTypes.instanceOf(Date),roundRangeLimits:PropTypes.bool,selectRange:PropTypes.bool,style:PropTypes.string,weekStart:PropTypes.number,year:PropTypes.number,onDayClick:PropTypes.func,onDayContextMenu:PropTypes.func,onDayEnter:PropTypes.func,onDayLeave:PropTypes.func,onRenderEnd:PropTypes.func,onSelectRange:PropTypes.func,onYearChanged:PropTypes.func}),module.exports=Calendar;
"use strict";function _interopDefault$1(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var React=_interopDefault$1(require("react")),PropTypes=_interopDefault$1(require("prop-types"));function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var jsYearCalendar=createCommonjsModule(function(e,t){!function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=function(){function D(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,D),s(this,"element",void 0),s(this,"options",void 0),s(this,"_dataSource",void 0),s(this,"_mouseDown",void 0),s(this,"_rangeStart",void 0),s(this,"_rangeEnd",void 0),s(this,"_responsiveInterval",void 0),s(this,"_nbCols",void 0),s(this,"clickDay",void 0),s(this,"dayContextMenu",void 0),s(this,"mouseOnDay",void 0),s(this,"mouseOutDay",void 0),s(this,"renderEnd",void 0),s(this,"selectRange",void 0),s(this,"yearChanged",void 0),e instanceof HTMLElement)this.element=e;else{if("string"!=typeof e)throw new Error("The element parameter should be a DOM node or a selector");this.element=document.querySelector(e)}this.element.classList.add("calendar"),this._initializeEvents(t),this._initializeOptions(t),this.setYear(this.options.startYear)}return e=D,(t=[{key:"_initializeOptions",value:function(e){null==e&&(e={}),this.options={startYear:isNaN(parseInt(e.startYear))?(new Date).getFullYear():parseInt(e.startYear),minDate:e.minDate instanceof Date?e.minDate:null,maxDate:e.maxDate instanceof Date?e.maxDate:null,language:null!=e.language&&null!=D.locales[e.language]?e.language:"en",allowOverlap:null==e.allowOverlap||e.allowOverlap,displayWeekNumber:null!=e.displayWeekNumber&&e.displayWeekNumber,displayDisabledDataSource:null!=e.displayDisabledDataSource&&e.displayDisabledDataSource,displayHeader:null==e.displayHeader||e.displayHeader,alwaysHalfDay:null!=e.alwaysHalfDay&&e.alwaysHalfDay,enableRangeSelection:null!=e.enableRangeSelection&&e.enableRangeSelection,disabledDays:e.disabledDays instanceof Array?e.disabledDays:[],disabledWeekDays:e.disabledWeekDays instanceof Array?e.disabledWeekDays:[],hiddenWeekDays:e.hiddenWeekDays instanceof Array?e.hiddenWeekDays:[],roundRangeLimits:null!=e.roundRangeLimits&&e.roundRangeLimits,dataSource:e.dataSource instanceof Array||"function"==typeof e.dataSource?e.dataSource:[],style:"background"==e.style||"border"==e.style||"custom"==e.style?e.style:"border",enableContextMenu:null!=e.enableContextMenu&&e.enableContextMenu,contextMenuItems:e.contextMenuItems instanceof Array?e.contextMenuItems:[],customDayRenderer:"function"==typeof e.customDayRenderer?e.customDayRenderer:null,customDataSourceRenderer:"function"==typeof e.customDataSourceRenderer?e.customDataSourceRenderer:null,weekStart:isNaN(parseInt(e.weekStart))?null:parseInt(e.weekStart),loadingTemplate:"string"==typeof e.loadingTemplate||e.loadingTemplate instanceof HTMLElement?e.loadingTemplate:null},this.options.dataSource instanceof Array&&(this._dataSource=this.options.dataSource,this._initializeDatasourceColors())}},{key:"_initializeEvents",value:function(e){null==e&&(e=[]),e.yearChanged&&this.element.addEventListener("yearChanged",e.yearChanged),e.renderEnd&&this.element.addEventListener("renderEnd",e.renderEnd),e.clickDay&&this.element.addEventListener("clickDay",e.clickDay),e.dayContextMenu&&this.element.addEventListener("dayContextMenu",e.dayContextMenu),e.selectRange&&this.element.addEventListener("selectRange",e.selectRange),e.mouseOnDay&&this.element.addEventListener("mouseOnDay",e.mouseOnDay),e.mouseOutDay&&this.element.addEventListener("mouseOutDay",e.mouseOutDay)}},{key:"_fetchDataSource",value:function(e){if("function"==typeof this.options.dataSource){var t=this.options.dataSource;if(2==t.length)t(this.options.startYear,e);else{var n=t(this.options.startYear);n instanceof Array?e(n):n.then(e)}}else e(this.options.dataSource)}},{key:"_initializeDatasourceColors",value:function(){for(var e=0;e<this._dataSource.length;e++)null==this._dataSource[e].color&&(this._dataSource[e].color=D.colors[e%D.colors.length])}},{key:"render",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.element.firstChild;)this.element.removeChild(this.element.firstChild);if(this.options.displayHeader&&this._renderHeader(),e)this._renderLoading();else{this._renderBody(),this._renderDataSource(),this._applyEvents();var t=this.element.querySelector(".months-container");t.style.opacity="0",t.style.display="block",t.style.transition="opacity 0.5s",setTimeout(function(){t.style.opacity="1",setTimeout(function(){return t.style.transition=""},500)},0),this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function(){var e=document.createElement("div");e.classList.add("calendar-header");var t=document.createElement("table"),n=document.createElement("th");n.classList.add("prev"),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&n.classList.add("disabled");var a=document.createElement("span");a.innerHTML="&lsaquo;",n.appendChild(a),t.appendChild(n);var s=document.createElement("th");s.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),s.textContent=(this.options.startYear-2).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-2,11,31)&&s.classList.add("disabled"),t.appendChild(s);var r=document.createElement("th");r.classList.add("year-title","year-neighbor","hidden-xs"),r.textContent=(this.options.startYear-1).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&r.classList.add("disabled"),t.appendChild(r);var o=document.createElement("th");o.classList.add("year-title"),o.textContent=this.options.startYear.toString(),t.appendChild(o);var i=document.createElement("th");i.classList.add("year-title","year-neighbor","hidden-xs"),i.textContent=(this.options.startYear+1).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&i.classList.add("disabled"),t.appendChild(i);var l=document.createElement("th");l.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),l.textContent=(this.options.startYear+2).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+2,0,1)&&l.classList.add("disabled"),t.appendChild(l);var d=document.createElement("th");d.classList.add("next"),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&d.classList.add("disabled");var u=document.createElement("span");u.innerHTML="&rsaquo;",d.appendChild(u),t.appendChild(d),e.appendChild(t),this.element.appendChild(e)}},{key:"_renderBody",value:function(){var e=document.createElement("div");e.classList.add("months-container");for(var t=0;t<12;t++){var n=document.createElement("div");n.classList.add("month-container"),n.dataset.monthId=t.toString(),this._nbCols&&n.classList.add("month-".concat(this._nbCols));var a=new Date(this.options.startYear,t,1),s=document.createElement("table");s.classList.add("month");var r=document.createElement("thead"),o=document.createElement("tr"),i=document.createElement("th");i.classList.add("month-title"),i.setAttribute("colspan",this.options.displayWeekNumber?"8":"7"),i.textContent=D.locales[this.options.language].months[t],o.appendChild(i),r.appendChild(o);var l=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("th");d.classList.add("week-number"),d.textContent=D.locales[this.options.language].weekShort,l.appendChild(d)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart,c=u;do{var p=document.createElement("th");p.classList.add("day-header"),p.textContent=D.locales[this.options.language].daysMin[c],this._isHidden(c)&&p.classList.add("hidden"),l.appendChild(p),7<=++c&&(c=0)}while(c!=u);r.appendChild(l),s.appendChild(r);for(var h=new Date(a.getTime()),y=new Date(this.options.startYear,t+1,0);h.getDay()!=u;)h.setDate(h.getDate()-1);for(;h<=y;){var f=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("td"),m=new Date(h.getTime());m.setDate(m.getDate()-u+4),d.classList.add("week-number"),d.textContent=this.getWeekNumber(m).toString(),f.appendChild(d)}do{var g=document.createElement("td");if(g.classList.add("day"),this._isHidden(h.getDay())&&g.classList.add("hidden"),h<a)g.classList.add("old");else if(y<h)g.classList.add("new");else{this._isDisabled(h)&&g.classList.add("disabled");var v=document.createElement("div");v.classList.add("day-content"),v.textContent=h.getDate().toString(),g.appendChild(v),this.options.customDayRenderer&&this.options.customDayRenderer(v,h)}f.appendChild(g),h.setDate(h.getDate()+1)}while(h.getDay()!=u);s.appendChild(f)}n.appendChild(s),e.appendChild(n)}this.element.appendChild(e)}},{key:"_renderLoading",value:function(){var e=document.createElement("div");e.classList.add("calendar-loading-container"),e.style.minHeight=200*this._nbCols+"px";var t=document.createElement("div");if(t.classList.add("calendar-loading"),this.options.loadingTemplate)"string"==typeof this.options.loadingTemplate?t.innerHTML=this.options.loadingTemplate:this.options.loadingTemplate instanceof HTMLElement&&t.appendChild(this.options.loadingTemplate);else{var n=document.createElement("div");n.classList.add("calendar-spinner");for(var a=1;a<=3;a++){var s=document.createElement("div");s.classList.add("bounce".concat(a)),n.appendChild(s)}t.appendChild(n)}e.appendChild(t),this.element.appendChild(e)}},{key:"_renderDataSource",value:function(){var i=this;null!=this._dataSource&&0<this._dataSource.length&&this.element.querySelectorAll(".month-container").forEach(function(e){var r=parseInt(e.dataset.monthId),t=new Date(i.options.startYear,r,1),n=new Date(i.options.startYear,r+1,1);if((null==i.options.minDate||n>i.options.minDate)&&(null==i.options.maxDate||t<=i.options.maxDate)){for(var o=[],a=0;a<i._dataSource.length;a++)i._dataSource[a].startDate>=n&&!(i._dataSource[a].endDate<t)||o.push(i._dataSource[a]);0<o.length&&e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(i.options.startYear,r,parseInt(e.textContent)),n=new Date(i.options.startYear,r,t.getDate()+1),a=[];if((null==i.options.minDate||t>=i.options.minDate)&&(null==i.options.maxDate||t<=i.options.maxDate)){for(var s=0;s<o.length;s++)o[s].startDate<n&&o[s].endDate>=t&&a.push(o[s]);0<a.length&&(i.options.displayDisabledDataSource||!i._isDisabled(t))&&i._renderDataSourceDay(e,t,a)}})}})}},{key:"_renderDataSourceDay",value:function(e,t,n){var a=e.parentElement;switch(this.options.style){case"border":var s=0;if(1==n.length?s=4:n.length<=3?s=2:a.style.boxShadow="inset 0 -4px 0 0 black",0<s){for(var r="",o=0;o<n.length;o++)""!=r&&(r+=","),r+="inset 0 -".concat((o+1)*s,"px 0 0 ").concat(n[o].color);a.style.boxShadow=r}break;case"background":a.style.backgroundColor=n[n.length-1].color;var i=t.getTime();if(n[n.length-1].startDate.getTime()==i)if(a.classList.add("day-start"),n[n.length-1].startHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].startDate.getTime()!=i||!n[o].startHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(-45deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-left");else if(n[n.length-1].endDate.getTime()==i)if(a.classList.add("day-end"),n[n.length-1].endHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].endDate.getTime()!=i||!n[o].endHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(135deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-right");break;case"custom":this.options.customDataSourceRenderer&&this.options.customDataSourceRenderer.call(this,e,t,n)}}},{key:"_applyEvents",value:function(){var r=this;this.options.displayHeader&&(this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){e.currentTarget.classList.contains("disabled")||r.setYear(parseInt(e.currentTarget.textContent))})}),this.element.querySelector(".calendar-header .prev").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=r.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){r.setYear(r.options.startYear-1)},50)},100)}}),this.element.querySelector(".calendar-header .next").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=r.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="-100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){r.setYear(r.options.startYear+1)},50)},100)}}));var e=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");e.forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation();var t=r._getDate(e.currentTarget);r._triggerEvent("clickDay",{element:e.currentTarget,date:t,events:r.getEvents(t)})}),e.addEventListener("contextmenu",function(e){r.options.enableContextMenu&&(e.preventDefault(),0<r.options.contextMenuItems.length&&r._openContextMenu(e.currentTarget));var t=r._getDate(e.currentTarget);r._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:r.getEvents(t)})}),r.options.enableRangeSelection&&(e.addEventListener("mousedown",function(e){if(1==e.which){var t=r._getDate(e.currentTarget);(r.options.allowOverlap||0==r.getEvents(t).length)&&(r._mouseDown=!0,r._rangeStart=r._rangeEnd=t,r._refreshRange())}}),e.addEventListener("mouseenter",function(e){if(r._mouseDown){var t=r._getDate(e.currentTarget);if(!r.options.allowOverlap){var n=new Date(r._rangeStart.getTime());if(n<t)for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);n<t&&!(0<r.getEvents(a).length);)n.setDate(n.getDate()+1),a.setDate(a.getDate()+1);else for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);t<n&&!(0<r.getEvents(a).length);)n.setDate(n.getDate()-1),a.setDate(a.getDate()-1);t=n}var s=r._rangeEnd;r._rangeEnd=t,s.getTime()!=r._rangeEnd.getTime()&&r._refreshRange()}})),e.addEventListener("mouseenter",function(e){if(!r._mouseDown){var t=r._getDate(e.currentTarget);r._triggerEvent("mouseOnDay",{element:e.currentTarget,date:t,events:r.getEvents(t)})}}),e.addEventListener("mouseleave",function(e){var t=r._getDate(e.currentTarget);r._triggerEvent("mouseOutDay",{element:e.currentTarget,date:t,events:r.getEvents(t)})})}),this.options.enableRangeSelection&&window.addEventListener("mouseup",function(e){if(r._mouseDown){r._mouseDown=!1,r._refreshRange();var t=r._rangeStart<r._rangeEnd?r._rangeStart:r._rangeEnd,n=r._rangeEnd>r._rangeStart?r._rangeEnd:r._rangeStart;r._triggerEvent("selectRange",{startDate:t,endDate:n,events:r.getEventsOnRange(t,new Date(n.getFullYear(),n.getMonth(),n.getDate()+1))})}}),this._responsiveInterval&&(clearInterval(this._responsiveInterval),this._responsiveInterval=null),this._responsiveInterval=setInterval(function(){if(null!=r.element.querySelector(".month")){var e=r.element.offsetWidth,t=r.element.querySelector(".month").offsetWidth+10;r._nbCols=null,r._nbCols=6*t<e?2:4*t<e?3:3*t<e?4:2*t<e?6:12,r.element.querySelectorAll(".month-container").forEach(function(e){e.classList.contains("month-".concat(r._nbCols))||(e.classList.remove("month-2","month-3","month-4","month-6","month-12"),e.classList.add("month-".concat(r._nbCols)))})}},300)}},{key:"_refreshRange",value:function(){var n=this;if(this.element.querySelectorAll("td.day.range").forEach(function(e){return e.classList.remove("range")}),this.element.querySelectorAll("td.day.range-start").forEach(function(e){return e.classList.remove("range-start")}),this.element.querySelectorAll("td.day.range-end").forEach(function(e){return e.classList.remove("range-end")}),this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd,s=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);a.getMonth()<=t&&s.getMonth()>=t&&e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);a<=t&&t<=s&&(e.classList.add("range"),t.getTime()==a.getTime()&&e.classList.add("range-start"),t.getTime()==s.getTime()&&e.classList.add("range-end"))})})}}},{key:"_getElementPosition",value:function(e){for(var t=0,n=0;t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;);return{top:t,left:n}}},{key:"_openContextMenu",value:function(e){var t=document.querySelector(".calendar-context-menu");if(null!==t)for(t.style.display="none";t.firstChild;)t.removeChild(t.firstChild);else(t=document.createElement("div")).classList.add("calendar-context-menu"),document.body.appendChild(t);for(var n=this._getDate(e),a=this.getEvents(n),s=0;s<a.length;s++){var r=document.createElement("div");r.classList.add("item"),r.style.borderLeft="4px solid ".concat(a[s].color);var o=document.createElement("div");o.classList.add("content"),o.textContent=a[s].name,r.appendChild(o);var i=document.createElement("span");i.innerHTML="&rsaquo;",r.appendChild(i),this._renderContextMenuItems(r,this.options.contextMenuItems,a[s]),t.appendChild(r)}if(0<t.children.length){var l=this._getElementPosition(e);t.style.left=l.left+25+"px",t.style.top=l.top+25+"px",t.style.display="block",window.addEventListener("mouseup",function(){t.style.display="none"},{once:!0})}}},{key:"_renderContextMenuItems",value:function(e,t,n){var a=document.createElement("div");a.classList.add("submenu");for(var s=0;s<t.length;s++)if(!1!==t[s].visible&&("function"!=typeof t[s].visible||t[s].visible(n))){var r=document.createElement("div");r.classList.add("item");var o=document.createElement("div");o.classList.add("content"),o.textContent=t[s].text,r.appendChild(o),t[s].click&&function(e){r.addEventListener("click",function(){t[e].click(n)})}(s);var i=document.createElement("span");i.innerHTML="&rsaquo;",r.appendChild(i),t[s].items&&0<t[s].items.length&&this._renderContextMenuItems(r,t[s].items,n),a.appendChild(r)}0<a.children.length&&e.appendChild(a)}},{key:"_getDate",value:function(e){var t=e.querySelector(":scope > .day-content").textContent,n=e.closest(".month-container").dataset.monthId,a=this.options.startYear;return new Date(a,n,t)}},{key:"_triggerEvent",value:function(e,t){var n=new Event(e);for(var a in n.calendar=this,t)n[a]=t[a];return this.element.dispatchEvent(n),n}},{key:"_isDisabled",value:function(e){if(null!=this.options.minDate&&e<this.options.minDate||null!=this.options.maxDate&&e>this.options.maxDate)return!0;if(0<this.options.disabledWeekDays.length)for(var t=0;t<this.options.disabledWeekDays.length;t++)if(e.getDay()==this.options.disabledWeekDays[t])return!0;if(0<this.options.disabledDays.length)for(var t=0;t<this.options.disabledDays.length;t++)if(e.getTime()==this.options.disabledDays[t].getTime())return!0;return!1}},{key:"_isHidden",value:function(e){if(0<this.options.hiddenWeekDays.length)for(var t=0;t<this.options.hiddenWeekDays.length;t++)if(e==this.options.hiddenWeekDays[t])return!0;return!1}},{key:"getWeekNumber",value:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)}},{key:"getEvents",value:function(e){return this.getEventsOnRange(e,new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))}},{key:"getEventsOnRange",value:function(e,t){var n=[];if(this._dataSource&&e&&t)for(var a=0;a<this._dataSource.length;a++)this._dataSource[a].startDate<t&&this._dataSource[a].endDate>=e&&n.push(this._dataSource[a]);return n}},{key:"getYear",value:function(){return this.options.startYear}},{key:"setYear",value:function(e){var t=this,n=parseInt(e);if(!isNaN(n)){for(this.options.startYear=n;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.options.displayHeader&&this._renderHeader();var a=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:!1});"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):a.preventRendering||this.render()}}},{key:"getMinDate",value:function(){return this.options.minDate}},{key:"setMinDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.minDate=e,t||this.render())}},{key:"getMaxDate",value:function(){return this.options.maxDate}},{key:"setMaxDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.maxDate=e,t||this.render())}},{key:"getStyle",value:function(){return this.options.style}},{key:"setStyle",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.style="background"==e||"border"==e||"custom"==e?e:"border",t||this.render()}},{key:"getAllowOverlap",value:function(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function(e){this.options.allowOverlap=e}},{key:"getDisplayWeekNumber",value:function(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayWeekNumber=e,t||this.render()}},{key:"getDisplayHeader",value:function(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayHeader=e,t||this.render()}},{key:"getDisplayDisabledDataSource",value:function(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayDisabledDataSource=e,t||this.render()}},{key:"getAlwaysHalfDay",value:function(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.alwaysHalfDay=e,t||this.render()}},{key:"getEnableRangeSelection",value:function(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableRangeSelection=e,t||this.render()}},{key:"getDisabledDays",value:function(){return this.options.disabledDays}},{key:"setDisabledDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledDays=e instanceof Array?e:[],t||this.render()}},{key:"getDisabledWeekDays",value:function(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getHiddenWeekDays",value:function(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.hiddenWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getRoundRangeLimits",value:function(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.roundRangeLimits=e,t||this.render()}},{key:"getEnableContextMenu",value:function(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableContextMenu=e,t||this.render()}},{key:"getContextMenuItems",value:function(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.contextMenuItems=e instanceof Array?e:[],t||this.render()}},{key:"getCustomDayRenderer",value:function(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDayRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getCustomDataSourceRenderer",value:function(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDataSourceRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getLanguage",value:function(){return this.options.language}},{key:"setLanguage",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!=e&&null!=D.locales[e]&&(this.options.language=e,t||this.render())}},{key:"getDataSource",value:function(){return this.options.dataSource}},{key:"setDataSource",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.dataSource=e instanceof Array||"function"==typeof e?e:[],"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):(this._initializeDatasourceColors(),n||this.render())}},{key:"getWeekStart",value:function(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.weekStart=isNaN(parseInt(e))?null:parseInt(e),t||this.render()}},{key:"getLoadingTemplate",value:function(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function(e){this.options.loadingTemplate="string"==typeof e||e instanceof HTMLElement?e:null}},{key:"addEvent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this._dataSource.push(e),t||this.render()}}])&&a(e.prototype,t),n&&a(e,n),D;var e,t,n}();s(e.default=n,"locales",{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekShort:"W",weekStart:0}}),s(n,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),"object"===("undefined"==typeof window?"undefined":t(window))&&(window.Calendar=n,document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new n(e)})}))}(t)}),JsCalendar=unwrapExports(jsYearCalendar),Calendar=function(e){function t(e){return _classCallCheck(this,t),_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e))}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidMount",value:function(){this.JsCalendar=new JsCalendar(this.container,{allowOverlap:this.props.allowOverlap,alwaysHalfDay:this.props.alwaysHalfDay,contextMenuItems:this.props.contextMenuItems,customDayRenderer:this.props.customDayRenderer,customDataSourceRenderer:this.props.customDataSourceRenderer,dataSource:this.props.dataSource,disabledDays:this.props.disabledDays,disabledWeekDays:this.props.disabledWeekDays,displayDisabledDataSource:this.props.displayDisabledDataSource,displayHeader:this.props.displayHeader,displayWeekNumber:this.props.displayWeekNumber,enableContextMenu:this.props.enableContextMenu,enableRangeSelection:this.props.enableRangeSelection,hiddenWeekDays:this.props.hiddenWeekDays,language:this.props.language,loadingTemplate:this.props.loadingTemplate,maxDate:this.props.maxDate,minDate:this.props.minDate,roundRangeLimits:this.props.roundRangeLimits,style:this.props.style,weekStart:this.props.weekStart,startYear:null!=this.props.year?this.props.year:this.props.defaultYear,clickDay:this.props.onDayClick,dayContextMenu:this.props.onDayContextMenu,mouseOnDay:this.props.onDayEnter,mouseOutDay:this.props.onDayLeave,renderEnd:this.props.onRenderEnd,selectRange:this.props.onRangeSelected,yearChanged:this.props.onYearChanged})}},{key:"updateEvent",value:function(e,t,n){this.container.removeEventListener(e,t),this.container.addEventListener(e,n)}},{key:"componentWillReceiveProps",value:function(e){var t=this.JsCalendar,n=[];e.allowOverlap!=this.props.allowOverlap&&n.push(function(){return t.setAllowOverlap(e.allowOverlap,!1)}),e.alwaysHalfDay!=this.props.alwaysHalfDay&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!1)}),e.contextMenuItems!=this.props.contextMenuItems&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!1)}),e.customDayRenderer!=this.props.customDayRenderer&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!1)}),e.customDataSourceRenderer!=this.props.customDataSourceRenderer&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!1)}),e.dataSource!=this.props.dataSource&&n.push(function(){return t.setDataSource(e.dataSource,!1)}),e.disabledDays!=this.props.disabledDays&&n.push(function(){return t.setDisabledDays(e.disabledDays,!1)}),e.disabledWeekDays!=this.props.disabledWeekDays&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!1)}),e.displayDisabledDataSource!=this.props.displayDisabledDataSource&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!1)}),e.displayHeader!=this.props.displayHeader&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!1)}),e.displayWeekNumber!=this.props.displayWeekNumber&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!1)}),e.enableContextMenu!=this.props.enableContextMenu&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!1)}),e.enableRangeSelection!=this.props.enableRangeSelection&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!1)}),e.hiddenWeekDays!=this.props.hiddenWeekDays&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!1)}),e.language!=this.props.language&&n.push(function(){return t.setLanguage(e.language,!1)}),e.loadingTemplate!=this.props.loadingTemplate&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!1)}),e.maxDate!=this.props.maxDate&&n.push(function(){return t.setMaxDate(e.maxDate,!1)}),e.minDate!=this.props.minDate&&n.push(function(){return t.setMinDate(e.minDate,!1)}),e.roundRangeLimits!=this.props.roundRangeLimits&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!1)}),e.style!=this.props.style&&n.push(function(){return t.setStyle(e.style,!1)}),e.weekStart!=this.props.weekStart&&n.push(function(){return t.setWeekStart(e.weekStart,!1)}),e.year!=this.props.year&&n.push(function(){return t.setYear(e.year)}),e.onDayClick!=this.props.onDayClick&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),e.onDayContextMenu!=this.props.onDayContextMenu&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),e.onDayEnter!=this.props.onDayEnter&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),e.onDayLeave!=this.props.onDayLeave&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),e.onRenderEnd!=this.props.onRenderEnd&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),e.onRangeSelected!=this.props.onRangeSelected&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),e.onYearChanged!=this.props.onYearChanged&&this.updateEvent("yearChanged",this.props.onYearChanged,e.onYearChanged),0<n.length&&(n.forEach(function(e){return e()}),e.year==this.props.year&&t.render())}},{key:"render",value:function(){var t=this;return React.createElement("div",{ref:function(e){return t.container=e}})}}]),t}();_defineProperty(Calendar,"propsTypes",{allowOverlap:PropTypes.bool,alwaysHalfDay:PropTypes.bool,contextMenuItems:PropTypes.arrayOf(PropTypes.shape({text:PropTypes.string,click:PropTypes.func,visible:PropTypes.oneOfType([PropTypes.bool,PropTypes.func]),items:PropTypes.array})),customDayRenderer:PropTypes.func,customDataSourceRenderer:PropTypes.func,dataSource:PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({startDate:PropTypes.instanceOf(Date),endDate:PropTypes.instanceOf(Date),name:PropTypes.string})),PropTypes.func]),disabledDays:PropTypes.arrayOf(PropTypes.instanceOf(Date)),disabledWeekDays:PropTypes.arrayOf(PropTypes.number),displayDisabledDataSource:PropTypes.bool,displayHeader:PropTypes.bool,displayWeekNumber:PropTypes.bool,enableContextMenu:PropTypes.bool,enableRangeSelection:PropTypes.bool,hiddenWeekDays:PropTypes.arrayOf(PropTypes.number),language:PropTypes.string,loadingTemplate:PropTypes.string,maxDate:PropTypes.instanceOf(Date),minDate:PropTypes.instanceOf(Date),roundRangeLimits:PropTypes.bool,selectRange:PropTypes.bool,style:PropTypes.string,weekStart:PropTypes.number,year:PropTypes.number,onDayClick:PropTypes.func,onDayContextMenu:PropTypes.func,onDayEnter:PropTypes.func,onDayLeave:PropTypes.func,onRenderEnd:PropTypes.func,onSelectRange:PropTypes.func,onYearChanged:PropTypes.func}),module.exports=Calendar;

@@ -1,1 +0,1 @@

!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";var e,t;e=void 0,t=function(i,e){function o(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}i=i&&i.hasOwnProperty("default")?i.default:i,e=e&&e.hasOwnProperty("default")?e.default:e;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t,n,a,s,u,c=(function(e,t){!function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=function(){function D(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,D),s(this,"element",void 0),s(this,"options",void 0),s(this,"_dataSource",void 0),s(this,"_mouseDown",void 0),s(this,"_rangeStart",void 0),s(this,"_rangeEnd",void 0),s(this,"_responsiveInterval",void 0),s(this,"clickDay",void 0),s(this,"dayContextMenu",void 0),s(this,"mouseOnDay",void 0),s(this,"mouseOutDay",void 0),s(this,"renderEnd",void 0),s(this,"selectRange",void 0),s(this,"yearChanged",void 0),e instanceof HTMLElement)this.element=e;else{if("string"!=typeof e)throw new Error("The element parameter should be a DOM node or a selector");this.element=document.querySelector(e)}this.element.classList.add("calendar"),this._initializeEvents(t),this._initializeOptions(t),this.setYear(this.options.startYear)}return e=D,(t=[{key:"_initializeOptions",value:function(e){null==e&&(e={}),this.options={startYear:isNaN(parseInt(e.startYear))?(new Date).getFullYear():parseInt(e.startYear),minDate:e.minDate instanceof Date?e.minDate:null,maxDate:e.maxDate instanceof Date?e.maxDate:null,language:null!=e.language&&null!=D.locales[e.language]?e.language:"en",allowOverlap:null==e.allowOverlap||e.allowOverlap,displayWeekNumber:null!=e.displayWeekNumber&&e.displayWeekNumber,displayDisabledDataSource:null!=e.displayDisabledDataSource&&e.displayDisabledDataSource,displayHeader:null==e.displayHeader||e.displayHeader,alwaysHalfDay:null!=e.alwaysHalfDay&&e.alwaysHalfDay,enableRangeSelection:null!=e.enableRangeSelection&&e.enableRangeSelection,disabledDays:e.disabledDays instanceof Array?e.disabledDays:[],disabledWeekDays:e.disabledWeekDays instanceof Array?e.disabledWeekDays:[],hiddenWeekDays:e.hiddenWeekDays instanceof Array?e.hiddenWeekDays:[],roundRangeLimits:null!=e.roundRangeLimits&&e.roundRangeLimits,dataSource:e.dataSource instanceof Array||"function"==typeof e.dataSource?e.dataSource:[],style:"background"==e.style||"border"==e.style||"custom"==e.style?e.style:"border",enableContextMenu:null!=e.enableContextMenu&&e.enableContextMenu,contextMenuItems:e.contextMenuItems instanceof Array?e.contextMenuItems:[],customDayRenderer:"function"==typeof e.customDayRenderer?e.customDayRenderer:null,customDataSourceRenderer:"function"==typeof e.customDataSourceRenderer?e.customDataSourceRenderer:null,weekStart:isNaN(parseInt(e.weekStart))?null:parseInt(e.weekStart),loadingTemplate:"string"==typeof e.loadingTemplate||e.loadingTemplate instanceof HTMLElement?e.loadingTemplate:null},this.options.dataSource instanceof Array&&(this._dataSource=this.options.dataSource,this._initializeDatasourceColors())}},{key:"_initializeEvents",value:function(e){null==e&&(e=[]),e.yearChanged&&this.element.addEventListener("yearChanged",e.yearChanged),e.renderEnd&&this.element.addEventListener("renderEnd",e.renderEnd),e.clickDay&&this.element.addEventListener("clickDay",e.clickDay),e.dayContextMenu&&this.element.addEventListener("dayContextMenu",e.dayContextMenu),e.selectRange&&this.element.addEventListener("selectRange",e.selectRange),e.mouseOnDay&&this.element.addEventListener("mouseOnDay",e.mouseOnDay),e.mouseOutDay&&this.element.addEventListener("mouseOutDay",e.mouseOutDay)}},{key:"_fetchDataSource",value:function(e){if("function"==typeof this.options.dataSource){var t=this.options.dataSource;if(2==t.length)t(this.options.startYear,e);else{var n=t(this.options.startYear);n instanceof Array?e(n):n.then(e)}}else e(this.options.dataSource)}},{key:"_initializeDatasourceColors",value:function(){for(var e=0;e<this._dataSource.length;e++)null==this._dataSource[e].color&&(this._dataSource[e].color=D.colors[e%D.colors.length])}},{key:"render",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.element.firstChild;)this.element.removeChild(this.element.firstChild);if(this.options.displayHeader&&this._renderHeader(),e)this._renderLoading();else{this._renderBody(),this._renderDataSource(),this._applyEvents();var t=this.element.querySelector(".months-container");t.style.opacity="0",t.style.display="block",t.style.transition="opacity 0.5s",setTimeout(function(){t.style.opacity="1",setTimeout(function(){return t.style.transition=""},500)},0),this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function(){var e=document.createElement("div");e.classList.add("calendar-header");var t=document.createElement("table"),n=document.createElement("th");n.classList.add("prev"),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&n.classList.add("disabled");var a=document.createElement("span");a.innerHTML="&lsaquo;",n.appendChild(a),t.appendChild(n);var s=document.createElement("th");s.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),s.textContent=(this.options.startYear-2).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-2,11,31)&&s.classList.add("disabled"),t.appendChild(s);var i=document.createElement("th");i.classList.add("year-title","year-neighbor","hidden-xs"),i.textContent=(this.options.startYear-1).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&i.classList.add("disabled"),t.appendChild(i);var o=document.createElement("th");o.classList.add("year-title"),o.textContent=this.options.startYear.toString(),t.appendChild(o);var r=document.createElement("th");r.classList.add("year-title","year-neighbor","hidden-xs"),r.textContent=(this.options.startYear+1).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&r.classList.add("disabled"),t.appendChild(r);var l=document.createElement("th");l.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),l.textContent=(this.options.startYear+2).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+2,0,1)&&l.classList.add("disabled"),t.appendChild(l);var d=document.createElement("th");d.classList.add("next"),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&d.classList.add("disabled");var u=document.createElement("span");u.innerHTML="&rsaquo;",d.appendChild(u),t.appendChild(d),e.appendChild(t),this.element.appendChild(e)}},{key:"_renderBody",value:function(){var e=document.createElement("div");e.classList.add("months-container");for(var t=0;t<12;t++){var n=document.createElement("div");n.classList.add("month-container"),n.dataset.monthId=t.toString();var a=new Date(this.options.startYear,t,1),s=document.createElement("table");s.classList.add("month");var i=document.createElement("thead"),o=document.createElement("tr"),r=document.createElement("th");r.classList.add("month-title"),r.setAttribute("colspan",this.options.displayWeekNumber?"8":"7"),r.textContent=D.locales[this.options.language].months[t],o.appendChild(r),i.appendChild(o);var l=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("th");d.classList.add("week-number"),d.textContent=D.locales[this.options.language].weekShort,l.appendChild(d)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart,c=u;do{var p=document.createElement("th");p.classList.add("day-header"),p.textContent=D.locales[this.options.language].daysMin[c],this._isHidden(c)&&p.classList.add("hidden"),l.appendChild(p),7<=++c&&(c=0)}while(c!=u);i.appendChild(l),s.appendChild(i);for(var h=new Date(a.getTime()),y=new Date(this.options.startYear,t+1,0);h.getDay()!=u;)h.setDate(h.getDate()-1);for(;h<=y;){var f=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("td"),m=new Date(h.getTime());m.setDate(m.getDate()-u+4),d.classList.add("week-number"),d.textContent=this.getWeekNumber(m).toString(),f.appendChild(d)}do{var g=document.createElement("td");if(g.classList.add("day"),this._isHidden(h.getDay())&&g.classList.add("hidden"),h<a)g.classList.add("old");else if(y<h)g.classList.add("new");else{this._isDisabled(h)&&g.classList.add("disabled");var v=document.createElement("div");v.classList.add("day-content"),v.textContent=h.getDate().toString(),g.appendChild(v),this.options.customDayRenderer&&this.options.customDayRenderer(v,h)}f.appendChild(g),h.setDate(h.getDate()+1)}while(h.getDay()!=u);s.appendChild(f)}n.appendChild(s),e.appendChild(n)}this.element.appendChild(e)}},{key:"_renderLoading",value:function(){var e=document.createElement("div");if(e.classList.add("calendar-loading"),this.options.loadingTemplate)"string"==typeof this.options.loadingTemplate?e.innerHTML=this.options.loadingTemplate:this.options.loadingTemplate instanceof HTMLElement&&e.appendChild(this.options.loadingTemplate);else{var t=document.createElement("div");t.classList.add("calendar-spinner");for(var n=1;n<=3;n++){var a=document.createElement("div");a.classList.add("bounce".concat(n)),t.appendChild(a)}e.appendChild(t)}this.element.appendChild(e)}},{key:"_renderDataSource",value:function(){var r=this;null!=this._dataSource&&0<this._dataSource.length&&this.element.querySelectorAll(".month-container").forEach(function(e){var i=parseInt(e.dataset.monthId),t=new Date(r.options.startYear,i,1),n=new Date(r.options.startYear,i+1,1);if((null==r.options.minDate||n>r.options.minDate)&&(null==r.options.maxDate||t<=r.options.maxDate)){for(var o=[],a=0;a<r._dataSource.length;a++)r._dataSource[a].startDate>=n&&!(r._dataSource[a].endDate<t)||o.push(r._dataSource[a]);0<o.length&&e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(r.options.startYear,i,parseInt(e.textContent)),n=new Date(r.options.startYear,i,t.getDate()+1),a=[];if((null==r.options.minDate||t>=r.options.minDate)&&(null==r.options.maxDate||t<=r.options.maxDate)){for(var s=0;s<o.length;s++)o[s].startDate<n&&o[s].endDate>=t&&a.push(o[s]);0<a.length&&(r.options.displayDisabledDataSource||!r._isDisabled(t))&&r._renderDataSourceDay(e,t,a)}})}})}},{key:"_renderDataSourceDay",value:function(e,t,n){var a=e.parentElement;switch(this.options.style){case"border":var s=0;if(1==n.length?s=4:n.length<=3?s=2:a.style.boxShadow="inset 0 -4px 0 0 black",0<s){for(var i="",o=0;o<n.length;o++)""!=i&&(i+=","),i+="inset 0 -".concat((o+1)*s,"px 0 0 ").concat(n[o].color);a.style.boxShadow=i}break;case"background":a.style.backgroundColor=n[n.length-1].color;var r=t.getTime();if(n[n.length-1].startDate.getTime()==r)if(a.classList.add("day-start"),n[n.length-1].startHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].startDate.getTime()!=r||!n[o].startHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(-45deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-left");else if(n[n.length-1].endDate.getTime()==r)if(a.classList.add("day-end"),n[n.length-1].endHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].endDate.getTime()!=r||!n[o].endHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(135deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-right");break;case"custom":this.options.customDataSourceRenderer&&this.options.customDataSourceRenderer.call(this,e,t,n)}}},{key:"_applyEvents",value:function(){var i=this;this.options.displayHeader&&(this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){e.currentTarget.classList.contains("disabled")||i.setYear(parseInt(e.currentTarget.textContent))})}),this.element.querySelector(".calendar-header .prev").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=i.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){i.setYear(i.options.startYear-1)},50)},100)}}),this.element.querySelector(".calendar-header .next").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=i.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="-100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){i.setYear(i.options.startYear+1)},50)},100)}}));var e=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");e.forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation();var t=i._getDate(e.currentTarget);i._triggerEvent("clickDay",{element:e.currentTarget,date:t,events:i.getEvents(t)})}),e.addEventListener("contextmenu",function(e){i.options.enableContextMenu&&(e.preventDefault(),0<i.options.contextMenuItems.length&&i._openContextMenu(e.currentTarget));var t=i._getDate(e.currentTarget);i._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:i.getEvents(t)})}),i.options.enableRangeSelection&&(e.addEventListener("mousedown",function(e){if(1==e.which){var t=i._getDate(e.currentTarget);(i.options.allowOverlap||0==i.getEvents(t).length)&&(i._mouseDown=!0,i._rangeStart=i._rangeEnd=t,i._refreshRange())}}),e.addEventListener("mouseenter",function(e){if(i._mouseDown){var t=i._getDate(e.currentTarget);if(!i.options.allowOverlap){var n=new Date(i._rangeStart.getTime());if(n<t)for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);n<t&&!(0<i.getEvents(a).length);)n.setDate(n.getDate()+1),a.setDate(a.getDate()+1);else for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);t<n&&!(0<i.getEvents(a).length);)n.setDate(n.getDate()-1),a.setDate(a.getDate()-1);t=n}var s=i._rangeEnd;i._rangeEnd=t,s.getTime()!=i._rangeEnd.getTime()&&i._refreshRange()}})),e.addEventListener("mouseenter",function(e){if(!i._mouseDown){var t=i._getDate(e.currentTarget);i._triggerEvent("mouseOnDay",{element:e.currentTarget,date:t,events:i.getEvents(t)})}}),e.addEventListener("mouseleave",function(e){var t=i._getDate(e.currentTarget);i._triggerEvent("mouseOutDay",{element:e.currentTarget,date:t,events:i.getEvents(t)})})}),this.options.enableRangeSelection&&window.addEventListener("mouseup",function(e){if(i._mouseDown){i._mouseDown=!1,i._refreshRange();var t=i._rangeStart<i._rangeEnd?i._rangeStart:i._rangeEnd,n=i._rangeEnd>i._rangeStart?i._rangeEnd:i._rangeStart;i._triggerEvent("selectRange",{startDate:t,endDate:n,events:i.getEventsOnRange(t,new Date(n.getFullYear(),n.getMonth(),n.getDate()+1))})}}),this._responsiveInterval&&(clearInterval(this._responsiveInterval),this._responsiveInterval=null),this._responsiveInterval=setInterval(function(){var e=i.element.offsetWidth,t=i.element.querySelector(".month").offsetWidth+10,n=null;n=6*t<e?2:4*t<e?3:3*t<e?4:2*t<e?6:12,i.element.querySelectorAll(".month-container").forEach(function(e){e.classList.contains("month-".concat(n))||(e.classList.remove("month-2","month-3","month-4","month-6","month-12"),e.classList.add("month-".concat(n)))})},300)}},{key:"_refreshRange",value:function(){var n=this;if(this.element.querySelectorAll("td.day.range").forEach(function(e){return e.classList.remove("range")}),this.element.querySelectorAll("td.day.range-start").forEach(function(e){return e.classList.remove("range-start")}),this.element.querySelectorAll("td.day.range-end").forEach(function(e){return e.classList.remove("range-end")}),this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd,s=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);a.getMonth()<=t&&s.getMonth()>=t&&e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);a<=t&&t<=s&&(e.classList.add("range"),t.getTime()==a.getTime()&&e.classList.add("range-start"),t.getTime()==s.getTime()&&e.classList.add("range-end"))})})}}},{key:"_openContextMenu",value:function(e){var t=document.querySelector(".calendar-context-menu");if(null!==t)for(t.style.display="none";t.firstChild;)t.removeChild(t.firstChild);else(t=document.createElement("div")).classList.add("calendar-context-menu"),document.body.appendChild(t);for(var n=this._getDate(e),a=this.getEvents(n),s=0;s<a.length;s++){var i=document.createElement("div");i.classList.add("item"),i.style.borderLeft="4px solid ".concat(a[s].color);var o=document.createElement("div");o.classList.add("content"),o.textContent=a[s].name,i.appendChild(o);var r=document.createElement("span");r.innerHTML="&rsaquo;",i.appendChild(r),this._renderContextMenuItems(i,this.options.contextMenuItems,a[s]),t.appendChild(i)}0<t.children.length&&(t.style.left=e.offsetLeft+25+"px",t.style.top=e.offsetTop+25+"px",t.style.display="block",window.addEventListener("mouseup",function(){t.style.display="none"},{once:!0}))}},{key:"_renderContextMenuItems",value:function(e,t,n){var a=document.createElement("div");a.classList.add("submenu");for(var s=0;s<t.length;s++)if(!1!==t[s].visible&&("function"!=typeof t[s].visible||t[s].visible(n))){var i=document.createElement("div");i.classList.add("item");var o=document.createElement("div");o.classList.add("content"),o.textContent=t[s].text,i.appendChild(o),t[s].click&&function(e){i.addEventListener("click",function(){t[e].click(n)})}(s);var r=document.createElement("span");r.innerHTML="&rsaquo;",i.appendChild(r),t[s].items&&0<t[s].items.length&&this._renderContextMenuItems(i,t[s].items,n),a.appendChild(i)}0<a.children.length&&e.appendChild(a)}},{key:"_getDate",value:function(e){var t=e.querySelector(":scope > .day-content").textContent,n=e.closest(".month-container").dataset.monthId,a=this.options.startYear;return new Date(a,n,t)}},{key:"_triggerEvent",value:function(e,t){var n=new Event(e);for(var a in n.calendar=this,t)n[a]=t[a];return this.element.dispatchEvent(n),n}},{key:"_isDisabled",value:function(e){if(null!=this.options.minDate&&e<this.options.minDate||null!=this.options.maxDate&&e>this.options.maxDate)return!0;if(0<this.options.disabledWeekDays.length)for(var t=0;t<this.options.disabledWeekDays.length;t++)if(e.getDay()==this.options.disabledWeekDays[t])return!0;if(0<this.options.disabledDays.length)for(var t=0;t<this.options.disabledDays.length;t++)if(e.getTime()==this.options.disabledDays[t].getTime())return!0;return!1}},{key:"_isHidden",value:function(e){if(0<this.options.hiddenWeekDays.length)for(var t=0;t<this.options.hiddenWeekDays.length;t++)if(e==this.options.hiddenWeekDays[t])return!0;return!1}},{key:"getWeekNumber",value:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)}},{key:"getEvents",value:function(e){return this.getEventsOnRange(e,new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))}},{key:"getEventsOnRange",value:function(e,t){var n=[];if(this._dataSource&&e&&t)for(var a=0;a<this._dataSource.length;a++)this._dataSource[a].startDate<t&&this._dataSource[a].endDate>=e&&n.push(this._dataSource[a]);return n}},{key:"getYear",value:function(){return this.options.startYear}},{key:"setYear",value:function(e){var t=this,n=parseInt(e);if(!isNaN(n)){for(this.options.startYear=n;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.options.displayHeader&&this._renderHeader();var a=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:!1});"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):a.preventRendering||this.render()}}},{key:"getMinDate",value:function(){return this.options.minDate}},{key:"setMinDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.minDate=e,t||this.render())}},{key:"getMaxDate",value:function(){return this.options.maxDate}},{key:"setMaxDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.maxDate=e,t||this.render())}},{key:"getStyle",value:function(){return this.options.style}},{key:"setStyle",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.style="background"==e||"border"==e||"custom"==e?e:"border",t||this.render()}},{key:"getAllowOverlap",value:function(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function(e){this.options.allowOverlap=e}},{key:"getDisplayWeekNumber",value:function(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayWeekNumber=e,t||this.render()}},{key:"getDisplayHeader",value:function(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayHeader=e,t||this.render()}},{key:"getDisplayDisabledDataSource",value:function(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayDisabledDataSource=e,t||this.render()}},{key:"getAlwaysHalfDay",value:function(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.alwaysHalfDay=e,t||this.render()}},{key:"getEnableRangeSelection",value:function(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableRangeSelection=e,t||this.render()}},{key:"getDisabledDays",value:function(){return this.options.disabledDays}},{key:"setDisabledDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledDays=e instanceof Array?e:[],t||this.render()}},{key:"getDisabledWeekDays",value:function(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getHiddenWeekDays",value:function(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.hiddenWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getRoundRangeLimits",value:function(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.roundRangeLimits=e,t||this.render()}},{key:"getEnableContextMenu",value:function(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableContextMenu=e,t||this.render()}},{key:"getContextMenuItems",value:function(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.contextMenuItems=e instanceof Array?e:[],t||this.render()}},{key:"getCustomDayRenderer",value:function(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDayRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getCustomDataSourceRenderer",value:function(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDataSourceRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getLanguage",value:function(){return this.options.language}},{key:"setLanguage",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!=e&&null!=D.locales[e]&&(this.options.language=e,t||this.render())}},{key:"getDataSource",value:function(){return this.options.dataSource}},{key:"setDataSource",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.dataSource=e instanceof Array||"function"==typeof e?e:[],"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):(this._initializeDatasourceColors(),n||this.render())}},{key:"getWeekStart",value:function(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.weekStart=isNaN(parseInt(e))?null:parseInt(e),t||this.render()}},{key:"getLoadingTemplate",value:function(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function(e){this.options.loadingTemplate="string"==typeof e||e instanceof HTMLElement?e:null}},{key:"addEvent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this._dataSource.push(e),t||this.render()}}])&&a(e.prototype,t),n&&a(e,n),D;var e,t,n}();s(e.default=n,"locales",{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekShort:"W",weekStart:0}}),s(n,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),"object"===("undefined"==typeof window?"undefined":t(window))&&(window.Calendar=n,document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new n(e)})}))}(t)}(t={exports:{}},t.exports),t.exports),p=(n=c)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,h=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,r(t).call(this,e))}var n,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(t,i.Component),n=t,(a=[{key:"componentDidMount",value:function(){this.JsCalendar=new p(this.container,{allowOverlap:this.props.allowOverlap,alwaysHalfDay:this.props.alwaysHalfDay,contextMenuItems:this.props.contextMenuItems,customDayRenderer:this.props.customDayRenderer,customDataSourceRenderer:this.props.customDataSourceRenderer,dataSource:this.props.dataSource,disabledDays:this.props.disabledDays,disabledWeekDays:this.props.disabledWeekDays,displayDisabledDataSource:this.props.displayDisabledDataSource,displayHeader:this.props.displayHeader,displayWeekNumber:this.props.displayWeekNumber,enableContextMenu:this.props.enableContextMenu,enableRangeSelection:this.props.enableRangeSelection,hiddenWeekDays:this.props.hiddenWeekDays,language:this.props.language,loadingTemplate:this.props.loadingTemplate,maxDate:this.props.maxDate,minDate:this.props.minDate,roundRangeLimits:this.props.roundRangeLimits,style:this.props.style,weekStart:this.props.weekStart,startYear:null!=this.props.year?this.props.year:this.props.defaultYear,clickDay:this.props.onDayClick,dayContextMenu:this.props.onDayContextMenu,mouseOnDay:this.props.onDayEnter,mouseOutDay:this.props.onDayLeave,renderEnd:this.props.onRenderEnd,selectRange:this.props.onRangeSelected,yearChanged:this.props.onYearChanged})}},{key:"updateEvent",value:function(e,t,n){this.container.removeEventListener(e,t),this.container.addEventListener(e,n)}},{key:"componentWillReceiveProps",value:function(e){var t=this.JsCalendar,n=[];e.allowOverlap!=this.props.allowOverlap&&n.push(function(){return t.setAllowOverlap(e.allowOverlap,!1)}),e.alwaysHalfDay!=this.props.alwaysHalfDay&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!1)}),e.contextMenuItems!=this.props.contextMenuItems&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!1)}),e.customDayRenderer!=this.props.customDayRenderer&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!1)}),e.customDataSourceRenderer!=this.props.customDataSourceRenderer&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!1)}),e.dataSource!=this.props.dataSource&&n.push(function(){return t.setDataSource(e.dataSource,!1)}),e.disabledDays!=this.props.disabledDays&&n.push(function(){return t.setDisabledDays(e.disabledDays,!1)}),e.disabledWeekDays!=this.props.disabledWeekDays&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!1)}),e.displayDisabledDataSource!=this.props.displayDisabledDataSource&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!1)}),e.displayHeader!=this.props.displayHeader&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!1)}),e.displayWeekNumber!=this.props.displayWeekNumber&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!1)}),e.enableContextMenu!=this.props.enableContextMenu&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!1)}),e.enableRangeSelection!=this.props.enableRangeSelection&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!1)}),e.hiddenWeekDays!=this.props.hiddenWeekDays&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!1)}),e.language!=this.props.language&&n.push(function(){return t.setLanguage(e.language,!1)}),e.loadingTemplate!=this.props.loadingTemplate&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!1)}),e.maxDate!=this.props.maxDate&&n.push(function(){return t.setMaxDate(e.maxDate,!1)}),e.minDate!=this.props.minDate&&n.push(function(){return t.setMinDate(e.minDate,!1)}),e.roundRangeLimits!=this.props.roundRangeLimits&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!1)}),e.style!=this.props.style&&n.push(function(){return t.setStyle(e.style,!1)}),e.weekStart!=this.props.weekStart&&n.push(function(){return t.setWeekStart(e.weekStart,!1)}),e.year!=this.props.year&&n.push(function(){return t.setYear(e.year)}),e.onDayClick!=this.props.onDayClick&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),e.onDayContextMenu!=this.props.onDayContextMenu&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),e.onDayEnter!=this.props.onDayEnter&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),e.onDayLeave!=this.props.onDayLeave&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),e.onRenderEnd!=this.props.onRenderEnd&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),e.onRangeSelected!=this.props.onRangeSelected&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),e.onYearChanged!=this.props.onYearChanged&&this.updateEvent("yearChanged",this.props.onYearChanged,e.onYearChanged),0<n.length&&(n.forEach(function(e){return e()}),e.year==this.props.year&&t.render())}},{key:"render",value:function(){var t=this;return i.createElement("div",{ref:function(e){return t.container=e}})}}])&&o(n.prototype,a),s&&o(n,s),t}();return a=h,s="propsTypes",u={allowOverlap:e.bool,alwaysHalfDay:e.bool,contextMenuItems:e.arrayOf(e.shape({text:e.string,click:e.func,visible:e.oneOfType([e.bool,e.func]),items:e.array})),customDayRenderer:e.func,customDataSourceRenderer:e.func,dataSource:e.oneOfType([e.arrayOf(e.shape({startDate:e.instanceOf(Date),endDate:e.instanceOf(Date),name:e.string})),e.func]),disabledDays:e.arrayOf(e.instanceOf(Date)),disabledWeekDays:e.arrayOf(e.number),displayDisabledDataSource:e.bool,displayHeader:e.bool,displayWeekNumber:e.bool,enableContextMenu:e.bool,enableRangeSelection:e.bool,hiddenWeekDays:e.arrayOf(e.number),language:e.string,loadingTemplate:e.string,maxDate:e.instanceOf(Date),minDate:e.instanceOf(Date),roundRangeLimits:e.bool,selectRange:e.bool,style:e.string,weekStart:e.number,year:e.number,onDayClick:e.func,onDayContextMenu:e.func,onDayEnter:e.func,onDayLeave:e.func,onRenderEnd:e.func,onSelectRange:e.func,onYearChanged:e.func},s in a?Object.defineProperty(a,s,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[s]=u,h},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):(e=e||self).Calendar=t(e.React,e.PropTypes)});
!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";var e,t;e=void 0,t=function(i,e){function o(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}i=i&&i.hasOwnProperty("default")?i.default:i,e=e&&e.hasOwnProperty("default")?e.default:e;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t,n,a,s,u,c=(function(e,t){!function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=function(){function D(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,D),s(this,"element",void 0),s(this,"options",void 0),s(this,"_dataSource",void 0),s(this,"_mouseDown",void 0),s(this,"_rangeStart",void 0),s(this,"_rangeEnd",void 0),s(this,"_responsiveInterval",void 0),s(this,"_nbCols",void 0),s(this,"clickDay",void 0),s(this,"dayContextMenu",void 0),s(this,"mouseOnDay",void 0),s(this,"mouseOutDay",void 0),s(this,"renderEnd",void 0),s(this,"selectRange",void 0),s(this,"yearChanged",void 0),e instanceof HTMLElement)this.element=e;else{if("string"!=typeof e)throw new Error("The element parameter should be a DOM node or a selector");this.element=document.querySelector(e)}this.element.classList.add("calendar"),this._initializeEvents(t),this._initializeOptions(t),this.setYear(this.options.startYear)}return e=D,(t=[{key:"_initializeOptions",value:function(e){null==e&&(e={}),this.options={startYear:isNaN(parseInt(e.startYear))?(new Date).getFullYear():parseInt(e.startYear),minDate:e.minDate instanceof Date?e.minDate:null,maxDate:e.maxDate instanceof Date?e.maxDate:null,language:null!=e.language&&null!=D.locales[e.language]?e.language:"en",allowOverlap:null==e.allowOverlap||e.allowOverlap,displayWeekNumber:null!=e.displayWeekNumber&&e.displayWeekNumber,displayDisabledDataSource:null!=e.displayDisabledDataSource&&e.displayDisabledDataSource,displayHeader:null==e.displayHeader||e.displayHeader,alwaysHalfDay:null!=e.alwaysHalfDay&&e.alwaysHalfDay,enableRangeSelection:null!=e.enableRangeSelection&&e.enableRangeSelection,disabledDays:e.disabledDays instanceof Array?e.disabledDays:[],disabledWeekDays:e.disabledWeekDays instanceof Array?e.disabledWeekDays:[],hiddenWeekDays:e.hiddenWeekDays instanceof Array?e.hiddenWeekDays:[],roundRangeLimits:null!=e.roundRangeLimits&&e.roundRangeLimits,dataSource:e.dataSource instanceof Array||"function"==typeof e.dataSource?e.dataSource:[],style:"background"==e.style||"border"==e.style||"custom"==e.style?e.style:"border",enableContextMenu:null!=e.enableContextMenu&&e.enableContextMenu,contextMenuItems:e.contextMenuItems instanceof Array?e.contextMenuItems:[],customDayRenderer:"function"==typeof e.customDayRenderer?e.customDayRenderer:null,customDataSourceRenderer:"function"==typeof e.customDataSourceRenderer?e.customDataSourceRenderer:null,weekStart:isNaN(parseInt(e.weekStart))?null:parseInt(e.weekStart),loadingTemplate:"string"==typeof e.loadingTemplate||e.loadingTemplate instanceof HTMLElement?e.loadingTemplate:null},this.options.dataSource instanceof Array&&(this._dataSource=this.options.dataSource,this._initializeDatasourceColors())}},{key:"_initializeEvents",value:function(e){null==e&&(e=[]),e.yearChanged&&this.element.addEventListener("yearChanged",e.yearChanged),e.renderEnd&&this.element.addEventListener("renderEnd",e.renderEnd),e.clickDay&&this.element.addEventListener("clickDay",e.clickDay),e.dayContextMenu&&this.element.addEventListener("dayContextMenu",e.dayContextMenu),e.selectRange&&this.element.addEventListener("selectRange",e.selectRange),e.mouseOnDay&&this.element.addEventListener("mouseOnDay",e.mouseOnDay),e.mouseOutDay&&this.element.addEventListener("mouseOutDay",e.mouseOutDay)}},{key:"_fetchDataSource",value:function(e){if("function"==typeof this.options.dataSource){var t=this.options.dataSource;if(2==t.length)t(this.options.startYear,e);else{var n=t(this.options.startYear);n instanceof Array?e(n):n.then(e)}}else e(this.options.dataSource)}},{key:"_initializeDatasourceColors",value:function(){for(var e=0;e<this._dataSource.length;e++)null==this._dataSource[e].color&&(this._dataSource[e].color=D.colors[e%D.colors.length])}},{key:"render",value:function(){for(var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.element.firstChild;)this.element.removeChild(this.element.firstChild);if(this.options.displayHeader&&this._renderHeader(),e)this._renderLoading();else{this._renderBody(),this._renderDataSource(),this._applyEvents();var t=this.element.querySelector(".months-container");t.style.opacity="0",t.style.display="block",t.style.transition="opacity 0.5s",setTimeout(function(){t.style.opacity="1",setTimeout(function(){return t.style.transition=""},500)},0),this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function(){var e=document.createElement("div");e.classList.add("calendar-header");var t=document.createElement("table"),n=document.createElement("th");n.classList.add("prev"),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&n.classList.add("disabled");var a=document.createElement("span");a.innerHTML="&lsaquo;",n.appendChild(a),t.appendChild(n);var s=document.createElement("th");s.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),s.textContent=(this.options.startYear-2).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-2,11,31)&&s.classList.add("disabled"),t.appendChild(s);var i=document.createElement("th");i.classList.add("year-title","year-neighbor","hidden-xs"),i.textContent=(this.options.startYear-1).toString(),null!=this.options.minDate&&this.options.minDate>new Date(this.options.startYear-1,11,31)&&i.classList.add("disabled"),t.appendChild(i);var o=document.createElement("th");o.classList.add("year-title"),o.textContent=this.options.startYear.toString(),t.appendChild(o);var r=document.createElement("th");r.classList.add("year-title","year-neighbor","hidden-xs"),r.textContent=(this.options.startYear+1).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&r.classList.add("disabled"),t.appendChild(r);var l=document.createElement("th");l.classList.add("year-title","year-neighbor2","hidden-sm","hidden-xs"),l.textContent=(this.options.startYear+2).toString(),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+2,0,1)&&l.classList.add("disabled"),t.appendChild(l);var d=document.createElement("th");d.classList.add("next"),null!=this.options.maxDate&&this.options.maxDate<new Date(this.options.startYear+1,0,1)&&d.classList.add("disabled");var u=document.createElement("span");u.innerHTML="&rsaquo;",d.appendChild(u),t.appendChild(d),e.appendChild(t),this.element.appendChild(e)}},{key:"_renderBody",value:function(){var e=document.createElement("div");e.classList.add("months-container");for(var t=0;t<12;t++){var n=document.createElement("div");n.classList.add("month-container"),n.dataset.monthId=t.toString(),this._nbCols&&n.classList.add("month-".concat(this._nbCols));var a=new Date(this.options.startYear,t,1),s=document.createElement("table");s.classList.add("month");var i=document.createElement("thead"),o=document.createElement("tr"),r=document.createElement("th");r.classList.add("month-title"),r.setAttribute("colspan",this.options.displayWeekNumber?"8":"7"),r.textContent=D.locales[this.options.language].months[t],o.appendChild(r),i.appendChild(o);var l=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("th");d.classList.add("week-number"),d.textContent=D.locales[this.options.language].weekShort,l.appendChild(d)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart,c=u;do{var p=document.createElement("th");p.classList.add("day-header"),p.textContent=D.locales[this.options.language].daysMin[c],this._isHidden(c)&&p.classList.add("hidden"),l.appendChild(p),7<=++c&&(c=0)}while(c!=u);i.appendChild(l),s.appendChild(i);for(var h=new Date(a.getTime()),y=new Date(this.options.startYear,t+1,0);h.getDay()!=u;)h.setDate(h.getDate()-1);for(;h<=y;){var f=document.createElement("tr");if(this.options.displayWeekNumber){var d=document.createElement("td"),m=new Date(h.getTime());m.setDate(m.getDate()-u+4),d.classList.add("week-number"),d.textContent=this.getWeekNumber(m).toString(),f.appendChild(d)}do{var g=document.createElement("td");if(g.classList.add("day"),this._isHidden(h.getDay())&&g.classList.add("hidden"),h<a)g.classList.add("old");else if(y<h)g.classList.add("new");else{this._isDisabled(h)&&g.classList.add("disabled");var v=document.createElement("div");v.classList.add("day-content"),v.textContent=h.getDate().toString(),g.appendChild(v),this.options.customDayRenderer&&this.options.customDayRenderer(v,h)}f.appendChild(g),h.setDate(h.getDate()+1)}while(h.getDay()!=u);s.appendChild(f)}n.appendChild(s),e.appendChild(n)}this.element.appendChild(e)}},{key:"_renderLoading",value:function(){var e=document.createElement("div");e.classList.add("calendar-loading-container"),e.style.minHeight=200*this._nbCols+"px";var t=document.createElement("div");if(t.classList.add("calendar-loading"),this.options.loadingTemplate)"string"==typeof this.options.loadingTemplate?t.innerHTML=this.options.loadingTemplate:this.options.loadingTemplate instanceof HTMLElement&&t.appendChild(this.options.loadingTemplate);else{var n=document.createElement("div");n.classList.add("calendar-spinner");for(var a=1;a<=3;a++){var s=document.createElement("div");s.classList.add("bounce".concat(a)),n.appendChild(s)}t.appendChild(n)}e.appendChild(t),this.element.appendChild(e)}},{key:"_renderDataSource",value:function(){var r=this;null!=this._dataSource&&0<this._dataSource.length&&this.element.querySelectorAll(".month-container").forEach(function(e){var i=parseInt(e.dataset.monthId),t=new Date(r.options.startYear,i,1),n=new Date(r.options.startYear,i+1,1);if((null==r.options.minDate||n>r.options.minDate)&&(null==r.options.maxDate||t<=r.options.maxDate)){for(var o=[],a=0;a<r._dataSource.length;a++)r._dataSource[a].startDate>=n&&!(r._dataSource[a].endDate<t)||o.push(r._dataSource[a]);0<o.length&&e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(r.options.startYear,i,parseInt(e.textContent)),n=new Date(r.options.startYear,i,t.getDate()+1),a=[];if((null==r.options.minDate||t>=r.options.minDate)&&(null==r.options.maxDate||t<=r.options.maxDate)){for(var s=0;s<o.length;s++)o[s].startDate<n&&o[s].endDate>=t&&a.push(o[s]);0<a.length&&(r.options.displayDisabledDataSource||!r._isDisabled(t))&&r._renderDataSourceDay(e,t,a)}})}})}},{key:"_renderDataSourceDay",value:function(e,t,n){var a=e.parentElement;switch(this.options.style){case"border":var s=0;if(1==n.length?s=4:n.length<=3?s=2:a.style.boxShadow="inset 0 -4px 0 0 black",0<s){for(var i="",o=0;o<n.length;o++)""!=i&&(i+=","),i+="inset 0 -".concat((o+1)*s,"px 0 0 ").concat(n[o].color);a.style.boxShadow=i}break;case"background":a.style.backgroundColor=n[n.length-1].color;var r=t.getTime();if(n[n.length-1].startDate.getTime()==r)if(a.classList.add("day-start"),n[n.length-1].startHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].startDate.getTime()!=r||!n[o].startHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(-45deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-left");else if(n[n.length-1].endDate.getTime()==r)if(a.classList.add("day-end"),n[n.length-1].endHalfDay||this.options.alwaysHalfDay){a.classList.add("day-half");for(var l="transparent",o=n.length-2;0<=o;o--)if(n[o].endDate.getTime()!=r||!n[o].endHalfDay&&!this.options.alwaysHalfDay){l=n[o].color;break}a.style.background="linear-gradient(135deg, ".concat(n[n.length-1].color,", ").concat(n[n.length-1].color," 49%, ").concat(l," 51%, ").concat(l,")")}else this.options.roundRangeLimits&&a.classList.add("round-right");break;case"custom":this.options.customDataSourceRenderer&&this.options.customDataSourceRenderer.call(this,e,t,n)}}},{key:"_applyEvents",value:function(){var i=this;this.options.displayHeader&&(this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){e.currentTarget.classList.contains("disabled")||i.setYear(parseInt(e.currentTarget.textContent))})}),this.element.querySelector(".calendar-header .prev").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=i.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){i.setYear(i.options.startYear-1)},50)},100)}}),this.element.querySelector(".calendar-header .next").addEventListener("click",function(e){if(!e.currentTarget.classList.contains("disabled")){var t=i.element.querySelector(".months-container");t.style.transition="margin-left 0.1s",t.style.marginLeft="-100%",setTimeout(function(){t.style.visibility="hidden",t.style.transition="",t.style.marginLeft="0",setTimeout(function(){i.setYear(i.options.startYear+1)},50)},100)}}));var e=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");e.forEach(function(e){e.addEventListener("click",function(e){e.stopPropagation();var t=i._getDate(e.currentTarget);i._triggerEvent("clickDay",{element:e.currentTarget,date:t,events:i.getEvents(t)})}),e.addEventListener("contextmenu",function(e){i.options.enableContextMenu&&(e.preventDefault(),0<i.options.contextMenuItems.length&&i._openContextMenu(e.currentTarget));var t=i._getDate(e.currentTarget);i._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:i.getEvents(t)})}),i.options.enableRangeSelection&&(e.addEventListener("mousedown",function(e){if(1==e.which){var t=i._getDate(e.currentTarget);(i.options.allowOverlap||0==i.getEvents(t).length)&&(i._mouseDown=!0,i._rangeStart=i._rangeEnd=t,i._refreshRange())}}),e.addEventListener("mouseenter",function(e){if(i._mouseDown){var t=i._getDate(e.currentTarget);if(!i.options.allowOverlap){var n=new Date(i._rangeStart.getTime());if(n<t)for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);n<t&&!(0<i.getEvents(a).length);)n.setDate(n.getDate()+1),a.setDate(a.getDate()+1);else for(var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);t<n&&!(0<i.getEvents(a).length);)n.setDate(n.getDate()-1),a.setDate(a.getDate()-1);t=n}var s=i._rangeEnd;i._rangeEnd=t,s.getTime()!=i._rangeEnd.getTime()&&i._refreshRange()}})),e.addEventListener("mouseenter",function(e){if(!i._mouseDown){var t=i._getDate(e.currentTarget);i._triggerEvent("mouseOnDay",{element:e.currentTarget,date:t,events:i.getEvents(t)})}}),e.addEventListener("mouseleave",function(e){var t=i._getDate(e.currentTarget);i._triggerEvent("mouseOutDay",{element:e.currentTarget,date:t,events:i.getEvents(t)})})}),this.options.enableRangeSelection&&window.addEventListener("mouseup",function(e){if(i._mouseDown){i._mouseDown=!1,i._refreshRange();var t=i._rangeStart<i._rangeEnd?i._rangeStart:i._rangeEnd,n=i._rangeEnd>i._rangeStart?i._rangeEnd:i._rangeStart;i._triggerEvent("selectRange",{startDate:t,endDate:n,events:i.getEventsOnRange(t,new Date(n.getFullYear(),n.getMonth(),n.getDate()+1))})}}),this._responsiveInterval&&(clearInterval(this._responsiveInterval),this._responsiveInterval=null),this._responsiveInterval=setInterval(function(){if(null!=i.element.querySelector(".month")){var e=i.element.offsetWidth,t=i.element.querySelector(".month").offsetWidth+10;i._nbCols=null,i._nbCols=6*t<e?2:4*t<e?3:3*t<e?4:2*t<e?6:12,i.element.querySelectorAll(".month-container").forEach(function(e){e.classList.contains("month-".concat(i._nbCols))||(e.classList.remove("month-2","month-3","month-4","month-6","month-12"),e.classList.add("month-".concat(i._nbCols)))})}},300)}},{key:"_refreshRange",value:function(){var n=this;if(this.element.querySelectorAll("td.day.range").forEach(function(e){return e.classList.remove("range")}),this.element.querySelectorAll("td.day.range-start").forEach(function(e){return e.classList.remove("range-start")}),this.element.querySelectorAll("td.day.range-end").forEach(function(e){return e.classList.remove("range-end")}),this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd,s=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);a.getMonth()<=t&&s.getMonth()>=t&&e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);a<=t&&t<=s&&(e.classList.add("range"),t.getTime()==a.getTime()&&e.classList.add("range-start"),t.getTime()==s.getTime()&&e.classList.add("range-end"))})})}}},{key:"_getElementPosition",value:function(e){for(var t=0,n=0;t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;);return{top:t,left:n}}},{key:"_openContextMenu",value:function(e){var t=document.querySelector(".calendar-context-menu");if(null!==t)for(t.style.display="none";t.firstChild;)t.removeChild(t.firstChild);else(t=document.createElement("div")).classList.add("calendar-context-menu"),document.body.appendChild(t);for(var n=this._getDate(e),a=this.getEvents(n),s=0;s<a.length;s++){var i=document.createElement("div");i.classList.add("item"),i.style.borderLeft="4px solid ".concat(a[s].color);var o=document.createElement("div");o.classList.add("content"),o.textContent=a[s].name,i.appendChild(o);var r=document.createElement("span");r.innerHTML="&rsaquo;",i.appendChild(r),this._renderContextMenuItems(i,this.options.contextMenuItems,a[s]),t.appendChild(i)}if(0<t.children.length){var l=this._getElementPosition(e);t.style.left=l.left+25+"px",t.style.top=l.top+25+"px",t.style.display="block",window.addEventListener("mouseup",function(){t.style.display="none"},{once:!0})}}},{key:"_renderContextMenuItems",value:function(e,t,n){var a=document.createElement("div");a.classList.add("submenu");for(var s=0;s<t.length;s++)if(!1!==t[s].visible&&("function"!=typeof t[s].visible||t[s].visible(n))){var i=document.createElement("div");i.classList.add("item");var o=document.createElement("div");o.classList.add("content"),o.textContent=t[s].text,i.appendChild(o),t[s].click&&function(e){i.addEventListener("click",function(){t[e].click(n)})}(s);var r=document.createElement("span");r.innerHTML="&rsaquo;",i.appendChild(r),t[s].items&&0<t[s].items.length&&this._renderContextMenuItems(i,t[s].items,n),a.appendChild(i)}0<a.children.length&&e.appendChild(a)}},{key:"_getDate",value:function(e){var t=e.querySelector(":scope > .day-content").textContent,n=e.closest(".month-container").dataset.monthId,a=this.options.startYear;return new Date(a,n,t)}},{key:"_triggerEvent",value:function(e,t){var n=new Event(e);for(var a in n.calendar=this,t)n[a]=t[a];return this.element.dispatchEvent(n),n}},{key:"_isDisabled",value:function(e){if(null!=this.options.minDate&&e<this.options.minDate||null!=this.options.maxDate&&e>this.options.maxDate)return!0;if(0<this.options.disabledWeekDays.length)for(var t=0;t<this.options.disabledWeekDays.length;t++)if(e.getDay()==this.options.disabledWeekDays[t])return!0;if(0<this.options.disabledDays.length)for(var t=0;t<this.options.disabledDays.length;t++)if(e.getTime()==this.options.disabledDays[t].getTime())return!0;return!1}},{key:"_isHidden",value:function(e){if(0<this.options.hiddenWeekDays.length)for(var t=0;t<this.options.hiddenWeekDays.length;t++)if(e==this.options.hiddenWeekDays[t])return!0;return!1}},{key:"getWeekNumber",value:function(e){var t=new Date(e.getTime());t.setHours(0,0,0,0),t.setDate(t.getDate()+3-(t.getDay()+6)%7);var n=new Date(t.getFullYear(),0,4);return 1+Math.round(((t.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)}},{key:"getEvents",value:function(e){return this.getEventsOnRange(e,new Date(e.getFullYear(),e.getMonth(),e.getDate()+1))}},{key:"getEventsOnRange",value:function(e,t){var n=[];if(this._dataSource&&e&&t)for(var a=0;a<this._dataSource.length;a++)this._dataSource[a].startDate<t&&this._dataSource[a].endDate>=e&&n.push(this._dataSource[a]);return n}},{key:"getYear",value:function(){return this.options.startYear}},{key:"setYear",value:function(e){var t=this,n=parseInt(e);if(!isNaN(n)){for(this.options.startYear=n;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.options.displayHeader&&this._renderHeader();var a=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:!1});"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):a.preventRendering||this.render()}}},{key:"getMinDate",value:function(){return this.options.minDate}},{key:"setMinDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.minDate=e,t||this.render())}},{key:"getMaxDate",value:function(){return this.options.maxDate}},{key:"setMaxDate",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];(e instanceof Date||null===e)&&(this.options.maxDate=e,t||this.render())}},{key:"getStyle",value:function(){return this.options.style}},{key:"setStyle",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.style="background"==e||"border"==e||"custom"==e?e:"border",t||this.render()}},{key:"getAllowOverlap",value:function(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function(e){this.options.allowOverlap=e}},{key:"getDisplayWeekNumber",value:function(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayWeekNumber=e,t||this.render()}},{key:"getDisplayHeader",value:function(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayHeader=e,t||this.render()}},{key:"getDisplayDisabledDataSource",value:function(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.displayDisabledDataSource=e,t||this.render()}},{key:"getAlwaysHalfDay",value:function(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.alwaysHalfDay=e,t||this.render()}},{key:"getEnableRangeSelection",value:function(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableRangeSelection=e,t||this.render()}},{key:"getDisabledDays",value:function(){return this.options.disabledDays}},{key:"setDisabledDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledDays=e instanceof Array?e:[],t||this.render()}},{key:"getDisabledWeekDays",value:function(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.disabledWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getHiddenWeekDays",value:function(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.hiddenWeekDays=e instanceof Array?e:[],t||this.render()}},{key:"getRoundRangeLimits",value:function(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.roundRangeLimits=e,t||this.render()}},{key:"getEnableContextMenu",value:function(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.enableContextMenu=e,t||this.render()}},{key:"getContextMenuItems",value:function(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.contextMenuItems=e instanceof Array?e:[],t||this.render()}},{key:"getCustomDayRenderer",value:function(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDayRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getCustomDataSourceRenderer",value:function(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.customDataSourceRenderer="function"==typeof e?e:null,t||this.render()}},{key:"getLanguage",value:function(){return this.options.language}},{key:"setLanguage",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!=e&&null!=D.locales[e]&&(this.options.language=e,t||this.render())}},{key:"getDataSource",value:function(){return this.options.dataSource}},{key:"setDataSource",value:function(e){var t=this,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.dataSource=e instanceof Array||"function"==typeof e?e:[],"function"==typeof this.options.dataSource?(this.render(!0),this._fetchDataSource(function(e){t._dataSource=e,t._initializeDatasourceColors(),t.render(!1)})):(this._initializeDatasourceColors(),n||this.render())}},{key:"getWeekStart",value:function(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this.options.weekStart=isNaN(parseInt(e))?null:parseInt(e),t||this.render()}},{key:"getLoadingTemplate",value:function(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function(e){this.options.loadingTemplate="string"==typeof e||e instanceof HTMLElement?e:null}},{key:"addEvent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];this._dataSource.push(e),t||this.render()}}])&&a(e.prototype,t),n&&a(e,n),D;var e,t,n}();s(e.default=n,"locales",{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekShort:"W",weekStart:0}}),s(n,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),"object"===("undefined"==typeof window?"undefined":t(window))&&(window.Calendar=n,document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new n(e)})}))}(t)}(t={exports:{}},t.exports),t.exports),p=(n=c)&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n,h=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),d(this,r(t).call(this,e))}var n,a,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(t,i.Component),n=t,(a=[{key:"componentDidMount",value:function(){this.JsCalendar=new p(this.container,{allowOverlap:this.props.allowOverlap,alwaysHalfDay:this.props.alwaysHalfDay,contextMenuItems:this.props.contextMenuItems,customDayRenderer:this.props.customDayRenderer,customDataSourceRenderer:this.props.customDataSourceRenderer,dataSource:this.props.dataSource,disabledDays:this.props.disabledDays,disabledWeekDays:this.props.disabledWeekDays,displayDisabledDataSource:this.props.displayDisabledDataSource,displayHeader:this.props.displayHeader,displayWeekNumber:this.props.displayWeekNumber,enableContextMenu:this.props.enableContextMenu,enableRangeSelection:this.props.enableRangeSelection,hiddenWeekDays:this.props.hiddenWeekDays,language:this.props.language,loadingTemplate:this.props.loadingTemplate,maxDate:this.props.maxDate,minDate:this.props.minDate,roundRangeLimits:this.props.roundRangeLimits,style:this.props.style,weekStart:this.props.weekStart,startYear:null!=this.props.year?this.props.year:this.props.defaultYear,clickDay:this.props.onDayClick,dayContextMenu:this.props.onDayContextMenu,mouseOnDay:this.props.onDayEnter,mouseOutDay:this.props.onDayLeave,renderEnd:this.props.onRenderEnd,selectRange:this.props.onRangeSelected,yearChanged:this.props.onYearChanged})}},{key:"updateEvent",value:function(e,t,n){this.container.removeEventListener(e,t),this.container.addEventListener(e,n)}},{key:"componentWillReceiveProps",value:function(e){var t=this.JsCalendar,n=[];e.allowOverlap!=this.props.allowOverlap&&n.push(function(){return t.setAllowOverlap(e.allowOverlap,!1)}),e.alwaysHalfDay!=this.props.alwaysHalfDay&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!1)}),e.contextMenuItems!=this.props.contextMenuItems&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!1)}),e.customDayRenderer!=this.props.customDayRenderer&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!1)}),e.customDataSourceRenderer!=this.props.customDataSourceRenderer&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!1)}),e.dataSource!=this.props.dataSource&&n.push(function(){return t.setDataSource(e.dataSource,!1)}),e.disabledDays!=this.props.disabledDays&&n.push(function(){return t.setDisabledDays(e.disabledDays,!1)}),e.disabledWeekDays!=this.props.disabledWeekDays&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!1)}),e.displayDisabledDataSource!=this.props.displayDisabledDataSource&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!1)}),e.displayHeader!=this.props.displayHeader&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!1)}),e.displayWeekNumber!=this.props.displayWeekNumber&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!1)}),e.enableContextMenu!=this.props.enableContextMenu&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!1)}),e.enableRangeSelection!=this.props.enableRangeSelection&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!1)}),e.hiddenWeekDays!=this.props.hiddenWeekDays&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!1)}),e.language!=this.props.language&&n.push(function(){return t.setLanguage(e.language,!1)}),e.loadingTemplate!=this.props.loadingTemplate&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!1)}),e.maxDate!=this.props.maxDate&&n.push(function(){return t.setMaxDate(e.maxDate,!1)}),e.minDate!=this.props.minDate&&n.push(function(){return t.setMinDate(e.minDate,!1)}),e.roundRangeLimits!=this.props.roundRangeLimits&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!1)}),e.style!=this.props.style&&n.push(function(){return t.setStyle(e.style,!1)}),e.weekStart!=this.props.weekStart&&n.push(function(){return t.setWeekStart(e.weekStart,!1)}),e.year!=this.props.year&&n.push(function(){return t.setYear(e.year)}),e.onDayClick!=this.props.onDayClick&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),e.onDayContextMenu!=this.props.onDayContextMenu&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),e.onDayEnter!=this.props.onDayEnter&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),e.onDayLeave!=this.props.onDayLeave&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),e.onRenderEnd!=this.props.onRenderEnd&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),e.onRangeSelected!=this.props.onRangeSelected&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),e.onYearChanged!=this.props.onYearChanged&&this.updateEvent("yearChanged",this.props.onYearChanged,e.onYearChanged),0<n.length&&(n.forEach(function(e){return e()}),e.year==this.props.year&&t.render())}},{key:"render",value:function(){var t=this;return i.createElement("div",{ref:function(e){return t.container=e}})}}])&&o(n.prototype,a),s&&o(n,s),t}();return a=h,s="propsTypes",u={allowOverlap:e.bool,alwaysHalfDay:e.bool,contextMenuItems:e.arrayOf(e.shape({text:e.string,click:e.func,visible:e.oneOfType([e.bool,e.func]),items:e.array})),customDayRenderer:e.func,customDataSourceRenderer:e.func,dataSource:e.oneOfType([e.arrayOf(e.shape({startDate:e.instanceOf(Date),endDate:e.instanceOf(Date),name:e.string})),e.func]),disabledDays:e.arrayOf(e.instanceOf(Date)),disabledWeekDays:e.arrayOf(e.number),displayDisabledDataSource:e.bool,displayHeader:e.bool,displayWeekNumber:e.bool,enableContextMenu:e.bool,enableRangeSelection:e.bool,hiddenWeekDays:e.arrayOf(e.number),language:e.string,loadingTemplate:e.string,maxDate:e.instanceOf(Date),minDate:e.instanceOf(Date),roundRangeLimits:e.bool,selectRange:e.bool,style:e.string,weekStart:e.number,year:e.number,onDayClick:e.func,onDayContextMenu:e.func,onDayEnter:e.func,onDayLeave:e.func,onRenderEnd:e.func,onSelectRange:e.func,onYearChanged:e.func},s in a?Object.defineProperty(a,s,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[s]=u,h},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["react","prop-types"],t):(e=e||self).Calendar=t(e.React,e.PropTypes)});
{
"name": "rc-year-calendar",
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.3",
"description": "Official react wrapper for the year-calendar widget",

@@ -9,3 +9,3 @@ "main": "./dist/rc-year-calendar.js",

"build": "rollup -c && npm run build:css",
"build:css": "cpx node_modules/js-year-calendar/dist/js-year-calendar.css dist/rc-year-calendar.css && cpx node_modules/js-year-calendar/dist/js-year-calendar.min.css dist/rc-year-calendar.min.css",
"build:css": "cpy node_modules/js-year-calendar/dist/js-year-calendar.css dist --rename=rc-year-calendar.css && cpy node_modules/js-year-calendar/dist/js-year-calendar.min.css dist --rename=rc-year-calendar.min.css",
"prepare": "npm run build"

@@ -35,3 +35,3 @@ },

"dependencies": {
"js-year-calendar": "^1.0.0-alpha.3"
"js-year-calendar": "^1.0.0-alpha.4"
},

@@ -49,3 +49,3 @@ "peerDependencies": {

"@babel/preset-env": "^7.3.1",
"cpx": "^1.5.0",
"cpy-cli": "^2.0.0",
"rollup": "^1.6.0",

@@ -52,0 +52,0 @@ "rollup-plugin-babel": "^4.3.2",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc