rc-year-calendar
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -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 _typeof(e){return(_typeof="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 _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 _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}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}function _createSuper(a){return function(){var e,t=_getPrototypeOf(a);if(_isNativeReflectConstruct()){var n=_getPrototypeOf(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return _possibleConstructorReturn(this,e)}}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"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){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){t=function e(t){return typeof t}}else{t=function e(t){return t&&typeof Symbol==="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}}return t(e)}function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||false;a.configurable=true;if("value"in a)a.writable=true;Object.defineProperty(e,a.key,a)}}function r(e,t,n){if(t)a(e.prototype,t);if(n)a(e,n);return e}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}if(Object.defineProperty(e,"__esModule",{value:true}),e["default"]=void 0,typeof NodeList!=="undefined"&&!NodeList.prototype.forEach){NodeList.prototype.forEach=function(e,t){t=t||window;for(var n=0;n<this.length;n++){e.call(t,this[n],n,this)}}}if(typeof Element!=="undefined"&&!Element.prototype.matches){var o=Element.prototype;Element.prototype.matches=o.msMatchesSelector||o.webkitMatchesSelector}if(typeof Element!=="undefined"&&!Element.prototype.closest){Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType==1);return null}}var s=function(){function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;n(this,D);i(this,"element",void 0);i(this,"options",void 0);i(this,"_dataSource",void 0);i(this,"_mouseDown",void 0);i(this,"_rangeStart",void 0);i(this,"_rangeEnd",void 0);i(this,"_responsiveInterval",void 0);i(this,"_nbCols",void 0);i(this,"clickDay",void 0);i(this,"dayContextMenu",void 0);i(this,"mouseOnDay",void 0);i(this,"mouseOutDay",void 0);i(this,"renderEnd",void 0);i(this,"selectRange",void 0);i(this,"yearChanged",void 0);if(e instanceof HTMLElement){this.element=e}else if(typeof e==="string"){this.element=document.querySelector(e)}else{throw new Error("The element parameter should be a DOM node or a selector")}this.element.classList.add("calendar");this._initializeEvents(t);this._initializeOptions(t);this.setYear(this.options.startYear)}r(D,[{key:"_initializeOptions",value:function e(t){if(t==null){t={}}this.options={startYear:!isNaN(parseInt(t.startYear))?parseInt(t.startYear):(new Date).getFullYear(),minDate:t.minDate instanceof Date?t.minDate:null,maxDate:t.maxDate instanceof Date?t.maxDate:null,language:t.language!=null&&D.locales[t.language]!=null?t.language:"en",allowOverlap:t.allowOverlap!=null?t.allowOverlap:true,displayWeekNumber:t.displayWeekNumber!=null?t.displayWeekNumber:false,displayDisabledDataSource:t.displayDisabledDataSource!=null?t.displayDisabledDataSource:false,displayHeader:t.displayHeader!=null?t.displayHeader:true,alwaysHalfDay:t.alwaysHalfDay!=null?t.alwaysHalfDay:false,enableRangeSelection:t.enableRangeSelection!=null?t.enableRangeSelection:false,disabledDays:t.disabledDays instanceof Array?t.disabledDays:[],disabledWeekDays:t.disabledWeekDays instanceof Array?t.disabledWeekDays:[],hiddenWeekDays:t.hiddenWeekDays instanceof Array?t.hiddenWeekDays:[],roundRangeLimits:t.roundRangeLimits!=null?t.roundRangeLimits:false,dataSource:t.dataSource instanceof Array||typeof t.dataSource==="function"?t.dataSource:[],style:t.style=="background"||t.style=="border"||t.style=="custom"?t.style:"border",enableContextMenu:t.enableContextMenu!=null?t.enableContextMenu:false,contextMenuItems:t.contextMenuItems instanceof Array?t.contextMenuItems:[],customDayRenderer:typeof t.customDayRenderer==="function"?t.customDayRenderer:null,customDataSourceRenderer:typeof t.customDataSourceRenderer==="function"?t.customDataSourceRenderer:null,weekStart:!isNaN(parseInt(t.weekStart))?parseInt(t.weekStart):null,loadingTemplate:typeof t.loadingTemplate==="string"||t.loadingTemplate instanceof HTMLElement?t.loadingTemplate:null};if(this.options.dataSource instanceof Array){this._dataSource=this.options.dataSource;this._initializeDatasourceColors()}}},{key:"_initializeEvents",value:function e(t){if(t==null){t=[]}if(t.yearChanged){this.element.addEventListener("yearChanged",t.yearChanged)}if(t.renderEnd){this.element.addEventListener("renderEnd",t.renderEnd)}if(t.clickDay){this.element.addEventListener("clickDay",t.clickDay)}if(t.dayContextMenu){this.element.addEventListener("dayContextMenu",t.dayContextMenu)}if(t.selectRange){this.element.addEventListener("selectRange",t.selectRange)}if(t.mouseOnDay){this.element.addEventListener("mouseOnDay",t.mouseOnDay)}if(t.mouseOutDay){this.element.addEventListener("mouseOutDay",t.mouseOutDay)}}},{key:"_fetchDataSource",value:function e(t){if(typeof this.options.dataSource==="function"){var n=this.options.dataSource;if(n.length==2){n(this.options.startYear,t)}else{var a=n(this.options.startYear);if(a instanceof Array){t(a)}else{a.then(t)}}}else{t(this.options.dataSource)}}},{key:"_initializeDatasourceColors",value:function e(){for(var t=0;t<this._dataSource.length;t++){if(this._dataSource[t].color==null){this._dataSource[t].color=D.colors[t%D.colors.length]}}}},{key:"render",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}if(t){this._renderLoading()}else{this._renderBody();this._renderDataSource();this._applyEvents();var n=this.element.querySelector(".months-container");n.style.opacity="0";n.style.display="block";n.style.transition="opacity 0.5s";setTimeout(function(){n.style.opacity="1";setTimeout(function(){return n.style.transition=""},500)},0);this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function e(){var t=document.createElement("div");t.classList.add("calendar-header");var n=document.createElement("table");var a=document.createElement("th");a.classList.add("prev");if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){a.classList.add("disabled")}var r=document.createElement("span");r.innerHTML="‹";a.appendChild(r);n.appendChild(a);var i=document.createElement("th");i.classList.add("year-title");i.classList.add("year-neighbor2");i.textContent=(this.options.startYear-2).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-2,11,31)){i.classList.add("disabled")}n.appendChild(i);var o=document.createElement("th");o.classList.add("year-title");o.classList.add("year-neighbor");o.textContent=(this.options.startYear-1).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){o.classList.add("disabled")}n.appendChild(o);var s=document.createElement("th");s.classList.add("year-title");s.textContent=this.options.startYear.toString();n.appendChild(s);var l=document.createElement("th");l.classList.add("year-title");l.classList.add("year-neighbor");l.textContent=(this.options.startYear+1).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){l.classList.add("disabled")}n.appendChild(l);var d=document.createElement("th");d.classList.add("year-title");d.classList.add("year-neighbor2");d.textContent=(this.options.startYear+2).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+2,0,1)){d.classList.add("disabled")}n.appendChild(d);var c=document.createElement("th");c.classList.add("next");if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){c.classList.add("disabled")}var u=document.createElement("span");u.innerHTML="›";c.appendChild(u);n.appendChild(c);t.appendChild(n);this.element.appendChild(t)}},{key:"_renderBody",value:function e(){var t=document.createElement("div");t.classList.add("months-container");for(var n=0;n<12;n++){var a=document.createElement("div");a.classList.add("month-container");a.dataset.monthId=n.toString();if(this._nbCols){a.classList.add("month-".concat(this._nbCols))}var r=new Date(this.options.startYear,n,1);var i=document.createElement("table");i.classList.add("month");var o=document.createElement("thead");var s=document.createElement("tr");var l=document.createElement("th");l.classList.add("month-title");l.setAttribute("colspan",this.options.displayWeekNumber?"8":"7");l.textContent=D.locales[this.options.language].months[n];s.appendChild(l);o.appendChild(s);var d=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("th");c.classList.add("week-number");c.textContent=D.locales[this.options.language].weekShort;d.appendChild(c)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart;var p=u;do{var h=document.createElement("th");h.classList.add("day-header");h.textContent=D.locales[this.options.language].daysMin[p];if(this._isHidden(p)){h.classList.add("hidden")}d.appendChild(h);p++;if(p>=7)p=0}while(p!=u);o.appendChild(d);i.appendChild(o);var f=new Date(r.getTime());var y=new Date(this.options.startYear,n+1,0);while(f.getDay()!=u){f.setDate(f.getDate()-1)}while(f<=y){var m=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("td");var g=new Date(f.getTime());g.setDate(g.getDate()-u+4);c.classList.add("week-number");c.textContent=this.getWeekNumber(g).toString();m.appendChild(c)}do{var v=document.createElement("td");v.classList.add("day");if(this._isHidden(f.getDay())){v.classList.add("hidden")}if(f<r){v.classList.add("old")}else if(f>y){v.classList.add("new")}else{if(this._isDisabled(f)){v.classList.add("disabled")}var b=document.createElement("div");b.classList.add("day-content");b.textContent=f.getDate().toString();v.appendChild(b);if(this.options.customDayRenderer){this.options.customDayRenderer(b,f)}}m.appendChild(v);f.setDate(f.getDate()+1)}while(f.getDay()!=u);i.appendChild(m)}a.appendChild(i);t.appendChild(a)}this.element.appendChild(t)}},{key:"_renderLoading",value:function e(){var t=document.createElement("div");t.classList.add("calendar-loading-container");t.style.minHeight=this._nbCols*200+"px";var n=document.createElement("div");n.classList.add("calendar-loading");if(this.options.loadingTemplate){if(typeof this.options.loadingTemplate==="string"){n.innerHTML=this.options.loadingTemplate}else if(this.options.loadingTemplate instanceof HTMLElement){n.appendChild(this.options.loadingTemplate)}}else{var a=document.createElement("div");a.classList.add("calendar-spinner");for(var r=1;r<=3;r++){var i=document.createElement("div");i.classList.add("bounce".concat(r));a.appendChild(i)}n.appendChild(a)}t.appendChild(n);this.element.appendChild(t)}},{key:"_renderDataSource",value:function e(){var s=this;if(this._dataSource!=null&&this._dataSource.length>0){this.element.querySelectorAll(".month-container").forEach(function(e){var i=parseInt(e.dataset.monthId);var t=new Date(s.options.startYear,i,1);var n=new Date(s.options.startYear,i+1,1);if((s.options.minDate==null||n>s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){var o=[];for(var a=0;a<s._dataSource.length;a++){if(!(s._dataSource[a].startDate>=n)||s._dataSource[a].endDate<t){o.push(s._dataSource[a])}}if(o.length>0){e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(s.options.startYear,i,parseInt(e.textContent));var n=new Date(s.options.startYear,i,t.getDate()+1);var a=[];if((s.options.minDate==null||t>=s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){for(var r=0;r<o.length;r++){if(o[r].startDate<n&&o[r].endDate>=t){a.push(o[r])}}if(a.length>0&&(s.options.displayDisabledDataSource||!s._isDisabled(t))){s._renderDataSourceDay(e,t,a)}}})}}})}}},{key:"_renderDataSourceDay",value:function e(t,n,a){var r=t.parentElement;switch(this.options.style){case"border":var i=0;if(a.length==1){i=4}else if(a.length<=3){i=2}else{r.style.boxShadow="inset 0 -4px 0 0 black"}if(i>0){var o="";for(var s=0;s<a.length;s++){if(o!=""){o+=","}o+="inset 0 -".concat((s+1)*i,"px 0 0 ").concat(a[s].color)}r.style.boxShadow=o}break;case"background":r.style.backgroundColor=a[a.length-1].color;var l=n.getTime();if(a[a.length-1].startDate.getTime()==l){r.classList.add("day-start");if(a[a.length-1].startHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].startDate.getTime()!=l||!a[s].startHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(-45deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-left")}}else if(a[a.length-1].endDate.getTime()==l){r.classList.add("day-end");if(a[a.length-1].endHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].endDate.getTime()!=l||!a[s].endHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(135deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-right")}}break;case"custom":if(this.options.customDataSourceRenderer){this.options.customDataSourceRenderer.call(this,t,n,a)}break}}},{key:"_applyEvents",value:function e(){var i=this;if(this.options.displayHeader){this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){if(!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 t=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");t.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){if(i.options.enableContextMenu){e.preventDefault();if(i.options.contextMenuItems.length>0){i._openContextMenu(e.currentTarget)}}var t=i._getDate(e.currentTarget);i._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:i.getEvents(t)})});if(i.options.enableRangeSelection){e.addEventListener("mousedown",function(e){if(e.which==1){var t=i._getDate(e.currentTarget);if(i.options.allowOverlap||i.isThereFreeSlot(t)){i._mouseDown=true;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){var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);while(n<t){if(!i.isThereFreeSlot(a,false)){break}n.setDate(n.getDate()+1);a.setDate(a.getDate()+1)}}else{var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);while(n>t){if(!i.isThereFreeSlot(a,true)){break}n.setDate(n.getDate()-1);a.setDate(a.getDate()-1)}}t=n}var r=i._rangeEnd;i._rangeEnd=t;if(r.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)})})});if(this.options.enableRangeSelection){window.addEventListener("mouseup",function(e){if(i._mouseDown){i._mouseDown=false;i._refreshRange();var t=i._rangeStart<i._rangeEnd?i._rangeStart:i._rangeEnd;var 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))})}})}if(this._responsiveInterval){clearInterval(this._responsiveInterval);this._responsiveInterval=null}this._responsiveInterval=setInterval(function(){if(i.element.querySelector(".month")==null){return}var e=i.element.offsetWidth;var t=i.element.querySelector(".month").offsetWidth+10;i._nbCols=null;if(t*6<e){i._nbCols=2}else if(t*4<e){i._nbCols=3}else if(t*3<e){i._nbCols=4}else if(t*2<e){i._nbCols=6}else{i._nbCols=12}i.element.querySelectorAll(".month-container").forEach(function(t){if(!t.classList.contains("month-".concat(i._nbCols))){["month-2","month-3","month-4","month-6","month-12"].forEach(function(e){t.classList.remove(e)});t.classList.add("month-".concat(i._nbCols))}})},300)}},{key:"_refreshRange",value:function e(){var n=this;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")});if(this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd;var r=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);if(a.getMonth()<=t&&r.getMonth()>=t){e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);if(t>=a&&t<=r){e.classList.add("range");if(t.getTime()==a.getTime()){e.classList.add("range-start")}if(t.getTime()==r.getTime()){e.classList.add("range-end")}}})}})}}},{key:"_getElementPosition",value:function e(t){var n=0,a=0;do{n+=t.offsetTop||0;a+=t.offsetLeft||0;t=t.offsetParent}while(t);return{top:n,left:a}}},{key:"_openContextMenu",value:function e(t){var n=document.querySelector(".calendar-context-menu");if(n!==null){n.style.display="none";while(n.firstChild){n.removeChild(n.firstChild)}}else{n=document.createElement("div");n.classList.add("calendar-context-menu");document.body.appendChild(n)}var a=this._getDate(t);var r=this.getEvents(a);for(var i=0;i<r.length;i++){var o=document.createElement("div");o.classList.add("item");o.style.borderLeft="4px solid ".concat(r[i].color);var s=document.createElement("div");s.classList.add("content");var l=document.createElement("span");l.classList.add("text");l.textContent=r[i].name;s.appendChild(l);var d=document.createElement("span");d.classList.add("arrow");d.innerHTML="›";s.appendChild(d);o.appendChild(s);this._renderContextMenuItems(o,this.options.contextMenuItems,r[i]);n.appendChild(o)}if(n.children.length>0){var c=this._getElementPosition(t);n.style.left=c.left+25+"px";n.style.top=c.top+25+"px";n.style.display="block";window.addEventListener("click",function(e){if(!n.contains(e.target)){n.style.display="none"}},{once:true})}}},{key:"_renderContextMenuItems",value:function e(t,n,a){var r=document.createElement("div");r.classList.add("submenu");for(var i=0;i<n.length;i++){if(n[i].visible===false||typeof n[i].visible==="function"&&!n[i].visible(a)){continue}var o=document.createElement("div");o.classList.add("item");var s=document.createElement("div");s.classList.add("content");var l=document.createElement("span");l.classList.add("text");l.textContent=n[i].text;s.appendChild(l);if(n[i].click){(function(e){s.addEventListener("click",function(){document.querySelector(".calendar-context-menu").style.display="none";n[e].click(a)})})(i)}o.appendChild(s);if(n[i].items&&n[i].items.length>0){var d=document.createElement("span");d.classList.add("arrow");d.innerHTML="›";s.appendChild(d);this._renderContextMenuItems(o,n[i].items,a)}r.appendChild(o)}if(r.children.length>0){t.appendChild(r)}}},{key:"_getDate",value:function e(t){var n=t.querySelector(".day-content").textContent;var a=t.closest(".month-container").dataset.monthId;var r=this.options.startYear;return new Date(r,a,n)}},{key:"_triggerEvent",value:function e(t,n){var a=null;if(typeof Event==="function"){a=new Event(t)}else{a=document.createEvent("Event");a.initEvent(t,false,false)}a.calendar=this;for(var r in n){a[r]=n[r]}this.element.dispatchEvent(a);return a}},{key:"_isDisabled",value:function e(t){if(this.options.minDate!=null&&t<this.options.minDate||this.options.maxDate!=null&&t>this.options.maxDate){return true}if(this.options.disabledWeekDays.length>0){for(var n=0;n<this.options.disabledWeekDays.length;n++){if(t.getDay()==this.options.disabledWeekDays[n]){return true}}}if(this.options.disabledDays.length>0){for(var n=0;n<this.options.disabledDays.length;n++){if(t.getTime()==this.options.disabledDays[n].getTime()){return true}}}return false}},{key:"_isHidden",value:function e(t){if(this.options.hiddenWeekDays.length>0){for(var n=0;n<this.options.hiddenWeekDays.length;n++){if(t==this.options.hiddenWeekDays[n]){return true}}}return false}},{key:"getWeekNumber",value:function e(t){var n=new Date(t.getTime());n.setHours(0,0,0,0);n.setDate(n.getDate()+3-(n.getDay()+6)%7);var a=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-a.getTime())/864e5-3+(a.getDay()+6)%7)/7)}},{key:"getEvents",value:function e(t){return this.getEventsOnRange(t,new Date(t.getFullYear(),t.getMonth(),t.getDate()+1))}},{key:"getEventsOnRange",value:function e(t,n){var a=[];if(this._dataSource&&t&&n){for(var r=0;r<this._dataSource.length;r++){if(this._dataSource[r].startDate<n&&this._dataSource[r].endDate>=t){a.push(this._dataSource[r])}}}return a}},{key:"isThereFreeSlot",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=this.getEvents(t);if(a===true){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.endHalfDay||e.endDate>t})}else if(a===false){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.startHalfDay||e.startDate<t})}else{return this.isThereFreeSlot(t,false)||this.isThereFreeSlot(t,true)}}},{key:"getYear",value:function e(){return this.options.startYear}},{key:"setYear",value:function e(t){var n=this;var a=parseInt(t);if(!isNaN(a)){this.options.startYear=a;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}var r=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:false});if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{if(!r.preventRendering){this.render()}}}}},{key:"getMinDate",value:function e(){return this.options.minDate}},{key:"setMinDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.minDate=t;if(!n){this.render()}}}},{key:"getMaxDate",value:function e(){return this.options.maxDate}},{key:"setMaxDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.maxDate=t;if(!n){this.render()}}}},{key:"getStyle",value:function e(){return this.options.style}},{key:"setStyle",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.style=t=="background"||t=="border"||t=="custom"?t:"border";if(!n){this.render()}}},{key:"getAllowOverlap",value:function e(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function e(t){this.options.allowOverlap=t}},{key:"getDisplayWeekNumber",value:function e(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayWeekNumber=t;if(!n){this.render()}}},{key:"getDisplayHeader",value:function e(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayHeader=t;if(!n){this.render()}}},{key:"getDisplayDisabledDataSource",value:function e(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayDisabledDataSource=t;if(!n){this.render()}}},{key:"getAlwaysHalfDay",value:function e(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.alwaysHalfDay=t;if(!n){this.render()}}},{key:"getEnableRangeSelection",value:function e(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableRangeSelection=t;if(!n){this.render()}}},{key:"getDisabledDays",value:function e(){return this.options.disabledDays}},{key:"setDisabledDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getDisabledWeekDays",value:function e(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getHiddenWeekDays",value:function e(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.hiddenWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getRoundRangeLimits",value:function e(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.roundRangeLimits=t;if(!n){this.render()}}},{key:"getEnableContextMenu",value:function e(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableContextMenu=t;if(!n){this.render()}}},{key:"getContextMenuItems",value:function e(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.contextMenuItems=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getCustomDayRenderer",value:function e(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDayRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getCustomDataSourceRenderer",value:function e(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDataSourceRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getLanguage",value:function e(){return this.options.language}},{key:"setLanguage",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t!=null&&D.locales[t]!=null){this.options.language=t;if(!n){this.render()}}}},{key:"getDataSource",value:function e(){return this.options.dataSource}},{key:"setDataSource",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.dataSource=t instanceof Array||typeof t==="function"?t:[];if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{this._dataSource=this.options.dataSource;this._initializeDatasourceColors();if(!a){this.render()}}}},{key:"getWeekStart",value:function e(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.weekStart=!isNaN(parseInt(t))?parseInt(t):null;if(!n){this.render()}}},{key:"getLoadingTemplate",value:function e(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function e(t){this.options.loadingTemplate=typeof t==="string"||t instanceof HTMLElement?t:null}},{key:"addEvent",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this._dataSource.push(t);if(!n){this.render()}}}]);return D}();if(i(e["default"]=s,"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}}),i(s,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),(typeof window==="undefined"?"undefined":t(window))==="object"){window.Calendar=s;document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new s(e)})})}}(t)}),JsCalendar=unwrapExports(jsYearCalendar);function styleInject(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}var css_248z='/* =========================================================\n * JS year calendar v0.1.0\n * Repo: https://github.com/year-calendar/js-year-calendar\n * =========================================================\n * Created by Paul David-Sivelle\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================= */\n/* Main */\n.calendar {\n padding: 4px;\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n direction: ltr;\n overflow-x: hidden;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n /* Header */\n /* Months */\n /* Loading */\n}\n.calendar:after {\n /* Apply the right height on the calendar div, even if the months elements are floating */\n clear: both;\n content: "";\n display: block;\n}\n.calendar .calendar-rtl {\n direction: rtl;\n}\n.calendar .calendar-rtl .calendar-rtl table tr td span {\n float: right;\n}\n.calendar table {\n margin: auto;\n border-spacing: 0;\n}\n.calendar table td,\n.calendar table th {\n text-align: center;\n width: 20px;\n height: 20px;\n border: none;\n padding: 4px 5px;\n font-size: 12px;\n}\n.calendar .calendar-header {\n width: 100%;\n margin-bottom: 20px;\n border: 1px solid #ddd;\n}\n.calendar .calendar-header table {\n width: 100%;\n}\n.calendar .calendar-header table th {\n font-size: 22px;\n padding: 5px 10px;\n cursor: pointer;\n}\n.calendar .calendar-header table th:hover {\n background: #eeeeee;\n}\n.calendar .calendar-header table th.disabled,\n.calendar .calendar-header table th.disabled:hover {\n background: none;\n cursor: default;\n color: white;\n}\n.calendar .calendar-header table th.prev,\n.calendar .calendar-header table th.next {\n width: 20px;\n}\n.calendar .calendar-header .year-title {\n font-weight: bold;\n text-align: center;\n height: 20px;\n width: auto;\n}\n.calendar .calendar-header .year-neighbor {\n opacity: 0.4;\n}\n@media (max-width: 991px) {\n .calendar .calendar-header .year-neighbor {\n display: none;\n }\n}\n.calendar .calendar-header .year-neighbor2 {\n opacity: 0.2;\n}\n@media (max-width: 767px) {\n .calendar .calendar-header .year-neighbor2 {\n display: none;\n }\n}\n.calendar .months-container {\n width: 100%;\n display: none;\n}\n.calendar .months-container .month-container {\n float: left;\n text-align: center;\n height: 200px;\n padding: 0;\n}\n.calendar .months-container .month-container.month-2 {\n width: 16.66666667%;\n}\n.calendar .months-container .month-container.month-3 {\n width: 25%;\n}\n.calendar .months-container .month-container.month-4 {\n width: 33.33333333%;\n}\n.calendar .months-container .month-container.month-6 {\n width: 50%;\n}\n.calendar .months-container .month-container.month-12 {\n width: 100%;\n}\n.calendar table.month th.month-title {\n font-size: 16px;\n padding-bottom: 5px;\n}\n.calendar table.month th.day-header {\n font-size: 14px;\n}\n.calendar table.month tr td,\n.calendar table.month tr th {\n padding: 0;\n}\n.calendar table.month tr td.hidden,\n.calendar table.month tr th.hidden {\n display: none;\n}\n.calendar table.month td.week-number {\n cursor: default;\n font-weight: bold;\n border-right: 1px solid #eee;\n padding: 5px;\n}\n.calendar table.month td.day.round-left {\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n border-radius: 8px 0 0 8px;\n}\n.calendar table.month td.day.round-right {\n webkit-border-radius: 0 8px 8px 0 ;\n -moz-border-radius: 0 8px 8px 0;\n border-radius: 0 8px 8px 0;\n}\n.calendar table.month td.day .day-content {\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n padding: 5px 6px;\n}\n.calendar table.month td.old,\n.calendar table.month td.new,\n.calendar table.month td.old:hover,\n.calendar table.month td.new:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.disabled,\n.calendar table.month td.disabled:hover {\n color: #dddddd;\n}\n.calendar table.month td.disabled .day-content:hover,\n.calendar table.month td.disabled:hover .day-content:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.range .day-content {\n background: rgba(0, 0, 0, 0.2);\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n}\n.calendar table.month td.range.range-start .day-content {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.calendar table.month td.range.range-end .day-content {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.calendar .calendar-loading-container {\n position: relative;\n text-align: center;\n min-height: 200px;\n}\n.calendar .calendar-loading-container .calendar-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}\n.calendar .calendar-spinner {\n margin: 20px auto;\n width: 80px;\n text-align: center;\n}\n.calendar .calendar-spinner > div {\n width: 16px;\n height: 16px;\n margin: 5px;\n background-color: #333;\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: sk-bouncedelay 1s infinite ease-in-out both;\n animation: sk-bouncedelay 1s infinite ease-in-out both;\n}\n.calendar .calendar-spinner > div.bounce1 {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s;\n}\n.calendar .calendar-spinner > div.bounce2 {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s;\n}\n/* Context menu */\n.calendar-context-menu,\n.calendar-context-menu .submenu {\n border: 1px solid #ddd;\n background-color: white;\n box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n position: absolute;\n display: none;\n}\n.calendar-context-menu .item {\n position: relative;\n}\n.calendar-context-menu .item .content {\n padding: 5px 10px;\n cursor: pointer;\n display: table;\n width: 100%;\n white-space: nowrap;\n}\n.calendar-context-menu .item .content:hover {\n background: #eee;\n}\n.calendar-context-menu .item .content .text {\n display: table-cell;\n}\n.calendar-context-menu .item .content .arrow {\n display: table-cell;\n padding-left: 10px;\n text-align: right;\n}\n.calendar-context-menu .item .submenu {\n left: 100%;\n top: -1px;\n /* Compensate for the border */\n}\n.calendar-context-menu .item:hover > .submenu {\n display: block;\n}\n.table-striped .calendar table.month tr td,\n.table-striped .calendar table.month tr th {\n background-color: transparent;\n}\ntable.month td.day .day-content:hover {\n background: rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n@-webkit-keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n }\n}\n@keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n}\n';styleInject(css_248z);var Calendar=function(){_inherits(n,React.Component);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e)}return _createClass(n,[{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:"compare",value:function(t,n){var a=this;if("function"==typeof t&&"function"==typeof n)return t.toString()!=n.toString();if(t instanceof Date&&n instanceof Date)return t.getTime()!=n.getTime();if(null===t||"object"!==_typeof(t)||null===n||"object"!==_typeof(n))return t!=n;var e=Object.keys(t),r=Object.keys(t);return e.length!==r.length||e.some(function(e){return a.compare(t[e],n[e])})}},{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=[];this.compare(e.allowOverlap,this.props.allowOverlap)&&n.push(function(){return t.setAllowOverlap(e.allowOverlap)}),this.compare(e.alwaysHalfDay,this.props.alwaysHalfDay)&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!0)}),this.compare(e.contextMenuItems,this.props.contextMenuItems)&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!0)}),this.compare(e.customDayRenderer,this.props.customDayRenderer)&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!0)}),this.compare(e.customDataSourceRenderer,this.props.customDataSourceRenderer)&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!0)}),this.compare(e.dataSource,this.props.dataSource)&&n.push(function(){return t.setDataSource(e.dataSource,!0)}),this.compare(e.disabledDays,this.props.disabledDays)&&n.push(function(){return t.setDisabledDays(e.disabledDays,!0)}),this.compare(e.disabledWeekDays,this.props.disabledWeekDays)&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!0)}),this.compare(e.displayDisabledDataSource,this.props.displayDisabledDataSource)&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!0)}),this.compare(e.displayHeader,this.props.displayHeader)&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!0)}),this.compare(e.displayWeekNumber,this.props.displayWeekNumber)&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!0)}),this.compare(e.enableContextMenu,this.props.enableContextMenu)&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!0)}),this.compare(e.enableRangeSelection,this.props.enableRangeSelection)&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!0)}),this.compare(e.hiddenWeekDays,this.props.hiddenWeekDays)&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!0)}),this.compare(e.language,this.props.language)&&n.push(function(){return t.setLanguage(e.language,!0)}),this.compare(e.loadingTemplate,this.props.loadingTemplate)&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!0)}),this.compare(e.maxDate,this.props.maxDate)&&n.push(function(){return t.setMaxDate(e.maxDate,!0)}),this.compare(e.minDate,this.props.minDate)&&n.push(function(){return t.setMinDate(e.minDate,!0)}),this.compare(e.roundRangeLimits,this.props.roundRangeLimits)&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!0)}),this.compare(e.style,this.props.style)&&n.push(function(){return t.setStyle(e.style,!0)}),this.compare(e.weekStart,this.props.weekStart)&&n.push(function(){return t.setWeekStart(e.weekStart,!0)}),this.compare(e.year,this.props.year)&&n.push(function(){return t.setYear(e.year)}),this.compare(e.onDayClick,this.props.onDayClick)&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),this.compare(e.onDayContextMenu,this.props.onDayContextMenu)&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),this.compare(e.onDayEnter,this.props.onDayEnter)&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),this.compare(e.onDayLeave,this.props.onDayLeave)&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),this.compare(e.onRenderEnd,this.props.onRenderEnd)&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),this.compare(e.onRangeSelected,this.props.onRangeSelected)&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),this.compare(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}})}}]),n}();_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}),_defineProperty(Calendar,"locales",JsCalendar.locales),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 _typeof(e){return(_typeof="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 _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 _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}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}function _createSuper(a){return function(){var e,t=_getPrototypeOf(a);if(_isNativeReflectConstruct()){var n=_getPrototypeOf(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return _possibleConstructorReturn(this,e)}}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"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){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){t=function e(t){return typeof t}}else{t=function e(t){return t&&typeof Symbol==="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}}return t(e)}function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||false;a.configurable=true;if("value"in a)a.writable=true;Object.defineProperty(e,a.key,a)}}function r(e,t,n){if(t)a(e.prototype,t);if(n)a(e,n);return e}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}if(Object.defineProperty(e,"__esModule",{value:true}),e["default"]=void 0,typeof NodeList!=="undefined"&&!NodeList.prototype.forEach){NodeList.prototype.forEach=function(e,t){t=t||window;for(var n=0;n<this.length;n++){e.call(t,this[n],n,this)}}}if(typeof Element!=="undefined"&&!Element.prototype.matches){var o=Element.prototype;Element.prototype.matches=o.msMatchesSelector||o.webkitMatchesSelector}if(typeof Element!=="undefined"&&!Element.prototype.closest){Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType==1);return null}}var s=function(){function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;n(this,D);i(this,"element",void 0);i(this,"options",void 0);i(this,"_dataSource",void 0);i(this,"_mouseDown",void 0);i(this,"_rangeStart",void 0);i(this,"_rangeEnd",void 0);i(this,"_responsiveInterval",void 0);i(this,"_nbCols",void 0);i(this,"clickDay",void 0);i(this,"dayContextMenu",void 0);i(this,"mouseOnDay",void 0);i(this,"mouseOutDay",void 0);i(this,"renderEnd",void 0);i(this,"selectRange",void 0);i(this,"yearChanged",void 0);if(e instanceof HTMLElement){this.element=e}else if(typeof e==="string"){this.element=document.querySelector(e)}else{throw new Error("The element parameter should be a DOM node or a selector")}this.element.classList.add("calendar");this._initializeEvents(t);this._initializeOptions(t);this.setYear(this.options.startYear)}r(D,[{key:"_initializeOptions",value:function e(t){if(t==null){t={}}this.options={startYear:!isNaN(parseInt(t.startYear))?parseInt(t.startYear):(new Date).getFullYear(),minDate:t.minDate instanceof Date?t.minDate:null,maxDate:t.maxDate instanceof Date?t.maxDate:null,language:t.language!=null&&D.locales[t.language]!=null?t.language:"en",allowOverlap:t.allowOverlap!=null?t.allowOverlap:true,displayWeekNumber:t.displayWeekNumber!=null?t.displayWeekNumber:false,displayDisabledDataSource:t.displayDisabledDataSource!=null?t.displayDisabledDataSource:false,displayHeader:t.displayHeader!=null?t.displayHeader:true,alwaysHalfDay:t.alwaysHalfDay!=null?t.alwaysHalfDay:false,enableRangeSelection:t.enableRangeSelection!=null?t.enableRangeSelection:false,disabledDays:t.disabledDays instanceof Array?t.disabledDays:[],disabledWeekDays:t.disabledWeekDays instanceof Array?t.disabledWeekDays:[],hiddenWeekDays:t.hiddenWeekDays instanceof Array?t.hiddenWeekDays:[],roundRangeLimits:t.roundRangeLimits!=null?t.roundRangeLimits:false,dataSource:t.dataSource instanceof Array||typeof t.dataSource==="function"?t.dataSource:[],style:t.style=="background"||t.style=="border"||t.style=="custom"?t.style:"border",enableContextMenu:t.enableContextMenu!=null?t.enableContextMenu:false,contextMenuItems:t.contextMenuItems instanceof Array?t.contextMenuItems:[],customDayRenderer:typeof t.customDayRenderer==="function"?t.customDayRenderer:null,customDataSourceRenderer:typeof t.customDataSourceRenderer==="function"?t.customDataSourceRenderer:null,weekStart:!isNaN(parseInt(t.weekStart))?parseInt(t.weekStart):null,loadingTemplate:typeof t.loadingTemplate==="string"||t.loadingTemplate instanceof HTMLElement?t.loadingTemplate:null};if(this.options.dataSource instanceof Array){this._dataSource=this.options.dataSource;this._initializeDatasourceColors()}}},{key:"_initializeEvents",value:function e(t){if(t==null){t=[]}if(t.yearChanged){this.element.addEventListener("yearChanged",t.yearChanged)}if(t.renderEnd){this.element.addEventListener("renderEnd",t.renderEnd)}if(t.clickDay){this.element.addEventListener("clickDay",t.clickDay)}if(t.dayContextMenu){this.element.addEventListener("dayContextMenu",t.dayContextMenu)}if(t.selectRange){this.element.addEventListener("selectRange",t.selectRange)}if(t.mouseOnDay){this.element.addEventListener("mouseOnDay",t.mouseOnDay)}if(t.mouseOutDay){this.element.addEventListener("mouseOutDay",t.mouseOutDay)}}},{key:"_fetchDataSource",value:function e(t){if(typeof this.options.dataSource==="function"){var n=this.options.dataSource;if(n.length==2){n(this.options.startYear,t)}else{var a=n(this.options.startYear);if(a instanceof Array){t(a)}else{a.then(t)}}}else{t(this.options.dataSource)}}},{key:"_initializeDatasourceColors",value:function e(){for(var t=0;t<this._dataSource.length;t++){if(this._dataSource[t].color==null){this._dataSource[t].color=D.colors[t%D.colors.length]}}}},{key:"render",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}if(t){this._renderLoading()}else{this._renderBody();this._renderDataSource();this._applyEvents();var n=this.element.querySelector(".months-container");n.style.opacity="0";n.style.display="block";n.style.transition="opacity 0.5s";setTimeout(function(){n.style.opacity="1";setTimeout(function(){return n.style.transition=""},500)},0);this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function e(){var t=document.createElement("div");t.classList.add("calendar-header");var n=document.createElement("table");var a=document.createElement("th");a.classList.add("prev");if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){a.classList.add("disabled")}var r=document.createElement("span");r.innerHTML="‹";a.appendChild(r);n.appendChild(a);var i=document.createElement("th");i.classList.add("year-title");i.classList.add("year-neighbor2");i.textContent=(this.options.startYear-2).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-2,11,31)){i.classList.add("disabled")}n.appendChild(i);var o=document.createElement("th");o.classList.add("year-title");o.classList.add("year-neighbor");o.textContent=(this.options.startYear-1).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){o.classList.add("disabled")}n.appendChild(o);var s=document.createElement("th");s.classList.add("year-title");s.textContent=this.options.startYear.toString();n.appendChild(s);var l=document.createElement("th");l.classList.add("year-title");l.classList.add("year-neighbor");l.textContent=(this.options.startYear+1).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){l.classList.add("disabled")}n.appendChild(l);var d=document.createElement("th");d.classList.add("year-title");d.classList.add("year-neighbor2");d.textContent=(this.options.startYear+2).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+2,0,1)){d.classList.add("disabled")}n.appendChild(d);var c=document.createElement("th");c.classList.add("next");if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){c.classList.add("disabled")}var u=document.createElement("span");u.innerHTML="›";c.appendChild(u);n.appendChild(c);t.appendChild(n);this.element.appendChild(t)}},{key:"_renderBody",value:function e(){var t=document.createElement("div");t.classList.add("months-container");for(var n=0;n<12;n++){var a=document.createElement("div");a.classList.add("month-container");a.dataset.monthId=n.toString();if(this._nbCols){a.classList.add("month-".concat(this._nbCols))}var r=new Date(this.options.startYear,n,1);var i=document.createElement("table");i.classList.add("month");var o=document.createElement("thead");var s=document.createElement("tr");var l=document.createElement("th");l.classList.add("month-title");l.setAttribute("colspan",this.options.displayWeekNumber?"8":"7");l.textContent=D.locales[this.options.language].months[n];s.appendChild(l);o.appendChild(s);var d=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("th");c.classList.add("week-number");c.textContent=D.locales[this.options.language].weekShort;d.appendChild(c)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart;var p=u;do{var h=document.createElement("th");h.classList.add("day-header");h.textContent=D.locales[this.options.language].daysMin[p];if(this._isHidden(p)){h.classList.add("hidden")}d.appendChild(h);p++;if(p>=7)p=0}while(p!=u);o.appendChild(d);i.appendChild(o);var f=new Date(r.getTime());var y=new Date(this.options.startYear,n+1,0);while(f.getDay()!=u){f.setDate(f.getDate()-1)}while(f<=y){var m=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("td");var g=new Date(f.getTime());g.setDate(g.getDate()-u+4);c.classList.add("week-number");c.textContent=this.getWeekNumber(g).toString();m.appendChild(c)}do{var v=document.createElement("td");v.classList.add("day");if(this._isHidden(f.getDay())){v.classList.add("hidden")}if(f<r){v.classList.add("old")}else if(f>y){v.classList.add("new")}else{if(this._isDisabled(f)){v.classList.add("disabled")}var b=document.createElement("div");b.classList.add("day-content");b.textContent=f.getDate().toString();v.appendChild(b);if(this.options.customDayRenderer){this.options.customDayRenderer(b,f)}}m.appendChild(v);f.setDate(f.getDate()+1)}while(f.getDay()!=u);i.appendChild(m)}a.appendChild(i);t.appendChild(a)}this.element.appendChild(t)}},{key:"_renderLoading",value:function e(){var t=document.createElement("div");t.classList.add("calendar-loading-container");t.style.minHeight=this._nbCols*200+"px";var n=document.createElement("div");n.classList.add("calendar-loading");if(this.options.loadingTemplate){if(typeof this.options.loadingTemplate==="string"){n.innerHTML=this.options.loadingTemplate}else if(this.options.loadingTemplate instanceof HTMLElement){n.appendChild(this.options.loadingTemplate)}}else{var a=document.createElement("div");a.classList.add("calendar-spinner");for(var r=1;r<=3;r++){var i=document.createElement("div");i.classList.add("bounce".concat(r));a.appendChild(i)}n.appendChild(a)}t.appendChild(n);this.element.appendChild(t)}},{key:"_renderDataSource",value:function e(){var s=this;if(this._dataSource!=null&&this._dataSource.length>0){this.element.querySelectorAll(".month-container").forEach(function(e){var i=parseInt(e.dataset.monthId);var t=new Date(s.options.startYear,i,1);var n=new Date(s.options.startYear,i+1,1);if((s.options.minDate==null||n>s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){var o=[];for(var a=0;a<s._dataSource.length;a++){if(!(s._dataSource[a].startDate>=n)||s._dataSource[a].endDate<t){o.push(s._dataSource[a])}}if(o.length>0){e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(s.options.startYear,i,parseInt(e.textContent));var n=new Date(s.options.startYear,i,t.getDate()+1);var a=[];if((s.options.minDate==null||t>=s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){for(var r=0;r<o.length;r++){if(o[r].startDate<n&&o[r].endDate>=t){a.push(o[r])}}if(a.length>0&&(s.options.displayDisabledDataSource||!s._isDisabled(t))){s._renderDataSourceDay(e,t,a)}}})}}})}}},{key:"_renderDataSourceDay",value:function e(t,n,a){var r=t.parentElement;switch(this.options.style){case"border":var i=0;if(a.length==1){i=4}else if(a.length<=3){i=2}else{r.style.boxShadow="inset 0 -4px 0 0 black"}if(i>0){var o="";for(var s=0;s<a.length;s++){if(o!=""){o+=","}o+="inset 0 -".concat((s+1)*i,"px 0 0 ").concat(a[s].color)}r.style.boxShadow=o}break;case"background":r.style.backgroundColor=a[a.length-1].color;var l=n.getTime();if(a[a.length-1].startDate.getTime()==l){r.classList.add("day-start");if(a[a.length-1].startHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].startDate.getTime()!=l||!a[s].startHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(-45deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-left")}}else if(a[a.length-1].endDate.getTime()==l){r.classList.add("day-end");if(a[a.length-1].endHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].endDate.getTime()!=l||!a[s].endHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(135deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-right")}}break;case"custom":if(this.options.customDataSourceRenderer){this.options.customDataSourceRenderer.call(this,t,n,a)}break}}},{key:"_applyEvents",value:function e(){var i=this;if(this.options.displayHeader){this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){if(!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 t=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");t.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){if(i.options.enableContextMenu){e.preventDefault();if(i.options.contextMenuItems.length>0){i._openContextMenu(e.currentTarget)}}var t=i._getDate(e.currentTarget);i._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:i.getEvents(t)})});if(i.options.enableRangeSelection){e.addEventListener("mousedown",function(e){if(e.which==1){var t=i._getDate(e.currentTarget);if(i.options.allowOverlap||i.isThereFreeSlot(t)){i._mouseDown=true;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){var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);while(n<t){if(!i.isThereFreeSlot(a,false)){break}n.setDate(n.getDate()+1);a.setDate(a.getDate()+1)}}else{var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);while(n>t){if(!i.isThereFreeSlot(a,true)){break}n.setDate(n.getDate()-1);a.setDate(a.getDate()-1)}}t=n}var r=i._rangeEnd;i._rangeEnd=t;if(r.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)})})});if(this.options.enableRangeSelection){window.addEventListener("mouseup",function(e){if(i._mouseDown){i._mouseDown=false;i._refreshRange();var t=i._rangeStart<i._rangeEnd?i._rangeStart:i._rangeEnd;var 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))})}})}if(this._responsiveInterval){clearInterval(this._responsiveInterval);this._responsiveInterval=null}this._responsiveInterval=setInterval(function(){if(i.element.querySelector(".month")==null){return}var e=i.element.offsetWidth;var t=i.element.querySelector(".month").offsetWidth+10;i._nbCols=null;if(t*6<e){i._nbCols=2}else if(t*4<e){i._nbCols=3}else if(t*3<e){i._nbCols=4}else if(t*2<e){i._nbCols=6}else{i._nbCols=12}i.element.querySelectorAll(".month-container").forEach(function(t){if(!t.classList.contains("month-".concat(i._nbCols))){["month-2","month-3","month-4","month-6","month-12"].forEach(function(e){t.classList.remove(e)});t.classList.add("month-".concat(i._nbCols))}})},300)}},{key:"_refreshRange",value:function e(){var n=this;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")});if(this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd;var r=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);if(a.getMonth()<=t&&r.getMonth()>=t){e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);if(t>=a&&t<=r){e.classList.add("range");if(t.getTime()==a.getTime()){e.classList.add("range-start")}if(t.getTime()==r.getTime()){e.classList.add("range-end")}}})}})}}},{key:"_getElementPosition",value:function e(t){var n=0,a=0;do{n+=t.offsetTop||0;a+=t.offsetLeft||0;t=t.offsetParent}while(t);return{top:n,left:a}}},{key:"_openContextMenu",value:function e(t){var n=this;var a=document.querySelector(".calendar-context-menu");if(a!==null){a.style.display="none";while(a.firstChild){a.removeChild(a.firstChild)}}else{a=document.createElement("div");a.classList.add("calendar-context-menu");document.body.appendChild(a)}var r=this._getDate(t);var i=this.getEvents(r);for(var o=0;o<i.length;o++){var s=document.createElement("div");s.classList.add("item");s.style.paddingLeft="4px";s.style.boxShadow="inset 4px 0 0 0 ".concat(i[o].color);var l=document.createElement("div");l.classList.add("content");var d=document.createElement("span");d.classList.add("text");d.textContent=i[o].name;l.appendChild(d);var c=document.createElement("span");c.classList.add("arrow");c.innerHTML="›";l.appendChild(c);s.appendChild(l);this._renderContextMenuItems(s,this.options.contextMenuItems,i[o]);a.appendChild(s)}if(a.children.length>0){var u=this._getElementPosition(t);a.style.left=u.left+25+"px";a.style.right="";a.style.top=u.top+25+"px";a.style.display="block";if(a.getBoundingClientRect().right>document.body.offsetWidth){a.style.left="";a.style.right="0"}setTimeout(function(){return n._checkContextMenuItemsPosition()},0);var p=function e(t){if(t.type!=="click"||!a.contains(t.target)){a.style.display="none";window.removeEventListener("click",e);window.removeEventListener("resize",e);window.removeEventListener("scroll",e)}};window.addEventListener("click",p);window.addEventListener("resize",p);window.addEventListener("scroll",p)}}},{key:"_renderContextMenuItems",value:function e(t,n,a){var r=document.createElement("div");r.classList.add("submenu");for(var i=0;i<n.length;i++){if(n[i].visible===false||typeof n[i].visible==="function"&&!n[i].visible(a)){continue}var o=document.createElement("div");o.classList.add("item");var s=document.createElement("div");s.classList.add("content");var l=document.createElement("span");l.classList.add("text");l.textContent=n[i].text;s.appendChild(l);if(n[i].click){(function(e){s.addEventListener("click",function(){document.querySelector(".calendar-context-menu").style.display="none";n[e].click(a)})})(i)}o.appendChild(s);if(n[i].items&&n[i].items.length>0){var d=document.createElement("span");d.classList.add("arrow");d.innerHTML="›";s.appendChild(d);this._renderContextMenuItems(o,n[i].items,a)}r.appendChild(o)}if(r.children.length>0){t.appendChild(r)}}},{key:"_checkContextMenuItemsPosition",value:function e(){var t=document.querySelectorAll(".calendar-context-menu .submenu");t.forEach(function(e){var t=e;t.style.display="block";t.style.visibility="hidden"});t.forEach(function(e){var t=e;if(t.getBoundingClientRect().right>document.body.offsetWidth){t.classList.add("open-left")}else{t.classList.remove("open-left")}});t.forEach(function(e){var t=e;t.style.display="";t.style.visibility=""})}},{key:"_getDate",value:function e(t){var n=t.querySelector(".day-content").textContent;var a=t.closest(".month-container").dataset.monthId;var r=this.options.startYear;return new Date(r,a,n)}},{key:"_triggerEvent",value:function e(t,n){var a=null;if(typeof Event==="function"){a=new Event(t)}else{a=document.createEvent("Event");a.initEvent(t,false,false)}a.calendar=this;for(var r in n){a[r]=n[r]}this.element.dispatchEvent(a);return a}},{key:"_isDisabled",value:function e(t){if(this.options.minDate!=null&&t<this.options.minDate||this.options.maxDate!=null&&t>this.options.maxDate){return true}if(this.options.disabledWeekDays.length>0){for(var n=0;n<this.options.disabledWeekDays.length;n++){if(t.getDay()==this.options.disabledWeekDays[n]){return true}}}if(this.options.disabledDays.length>0){for(var n=0;n<this.options.disabledDays.length;n++){if(t.getTime()==this.options.disabledDays[n].getTime()){return true}}}return false}},{key:"_isHidden",value:function e(t){if(this.options.hiddenWeekDays.length>0){for(var n=0;n<this.options.hiddenWeekDays.length;n++){if(t==this.options.hiddenWeekDays[n]){return true}}}return false}},{key:"getWeekNumber",value:function e(t){var n=new Date(t.getTime());n.setHours(0,0,0,0);n.setDate(n.getDate()+3-(n.getDay()+6)%7);var a=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-a.getTime())/864e5-3+(a.getDay()+6)%7)/7)}},{key:"getEvents",value:function e(t){return this.getEventsOnRange(t,new Date(t.getFullYear(),t.getMonth(),t.getDate()+1))}},{key:"getEventsOnRange",value:function e(t,n){var a=[];if(this._dataSource&&t&&n){for(var r=0;r<this._dataSource.length;r++){if(this._dataSource[r].startDate<n&&this._dataSource[r].endDate>=t){a.push(this._dataSource[r])}}}return a}},{key:"isThereFreeSlot",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=this.getEvents(t);if(a===true){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.endHalfDay||e.endDate>t})}else if(a===false){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.startHalfDay||e.startDate<t})}else{return this.isThereFreeSlot(t,false)||this.isThereFreeSlot(t,true)}}},{key:"getYear",value:function e(){return this.options.startYear}},{key:"setYear",value:function e(t){var n=this;var a=parseInt(t);if(!isNaN(a)){this.options.startYear=a;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}var r=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:false});if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{if(!r.preventRendering){this.render()}}}}},{key:"getMinDate",value:function e(){return this.options.minDate}},{key:"setMinDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.minDate=t;if(!n){this.render()}}}},{key:"getMaxDate",value:function e(){return this.options.maxDate}},{key:"setMaxDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.maxDate=t;if(!n){this.render()}}}},{key:"getStyle",value:function e(){return this.options.style}},{key:"setStyle",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.style=t=="background"||t=="border"||t=="custom"?t:"border";if(!n){this.render()}}},{key:"getAllowOverlap",value:function e(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function e(t){this.options.allowOverlap=t}},{key:"getDisplayWeekNumber",value:function e(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayWeekNumber=t;if(!n){this.render()}}},{key:"getDisplayHeader",value:function e(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayHeader=t;if(!n){this.render()}}},{key:"getDisplayDisabledDataSource",value:function e(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayDisabledDataSource=t;if(!n){this.render()}}},{key:"getAlwaysHalfDay",value:function e(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.alwaysHalfDay=t;if(!n){this.render()}}},{key:"getEnableRangeSelection",value:function e(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableRangeSelection=t;if(!n){this.render()}}},{key:"getDisabledDays",value:function e(){return this.options.disabledDays}},{key:"setDisabledDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getDisabledWeekDays",value:function e(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getHiddenWeekDays",value:function e(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.hiddenWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getRoundRangeLimits",value:function e(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.roundRangeLimits=t;if(!n){this.render()}}},{key:"getEnableContextMenu",value:function e(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableContextMenu=t;if(!n){this.render()}}},{key:"getContextMenuItems",value:function e(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.contextMenuItems=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getCustomDayRenderer",value:function e(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDayRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getCustomDataSourceRenderer",value:function e(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDataSourceRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getLanguage",value:function e(){return this.options.language}},{key:"setLanguage",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t!=null&&D.locales[t]!=null){this.options.language=t;if(!n){this.render()}}}},{key:"getDataSource",value:function e(){return this.options.dataSource}},{key:"setDataSource",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.dataSource=t instanceof Array||typeof t==="function"?t:[];if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{this._dataSource=this.options.dataSource;this._initializeDatasourceColors();if(!a){this.render()}}}},{key:"getWeekStart",value:function e(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.weekStart=!isNaN(parseInt(t))?parseInt(t):null;if(!n){this.render()}}},{key:"getLoadingTemplate",value:function e(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function e(t){this.options.loadingTemplate=typeof t==="string"||t instanceof HTMLElement?t:null}},{key:"addEvent",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this._dataSource.push(t);if(!n){this.render()}}}]);return D}();if(i(e["default"]=s,"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}}),i(s,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),(typeof window==="undefined"?"undefined":t(window))==="object"){window.Calendar=s;document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new s(e)})})}}(t)}),JsCalendar=unwrapExports(jsYearCalendar);function styleInject(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}var css_248z='/* =========================================================\n * JS year calendar v0.1.0\n * Repo: https://github.com/year-calendar/js-year-calendar\n * =========================================================\n * Created by Paul David-Sivelle\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================= */\n/* Main */\n.calendar {\n padding: 4px;\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n direction: ltr;\n overflow-x: hidden;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n /* Header */\n /* Months */\n /* Loading */\n}\n.calendar:after {\n /* Apply the right height on the calendar div, even if the months elements are floating */\n clear: both;\n content: "";\n display: block;\n}\n.calendar .calendar-rtl {\n direction: rtl;\n}\n.calendar .calendar-rtl .calendar-rtl table tr td span {\n float: right;\n}\n.calendar table {\n margin: auto;\n border-spacing: 0;\n}\n.calendar table td,\n.calendar table th {\n text-align: center;\n width: 20px;\n height: 20px;\n border: none;\n padding: 4px 5px;\n font-size: 12px;\n}\n.calendar .calendar-header {\n width: 100%;\n margin-bottom: 20px;\n border: 1px solid #ddd;\n}\n.calendar .calendar-header table {\n width: 100%;\n}\n.calendar .calendar-header table th {\n font-size: 22px;\n padding: 5px 10px;\n cursor: pointer;\n}\n.calendar .calendar-header table th:hover {\n background: #eeeeee;\n}\n.calendar .calendar-header table th.disabled,\n.calendar .calendar-header table th.disabled:hover {\n background: none;\n cursor: default;\n color: white;\n}\n.calendar .calendar-header table th.prev,\n.calendar .calendar-header table th.next {\n width: 20px;\n}\n.calendar .calendar-header .year-title {\n font-weight: bold;\n text-align: center;\n height: 20px;\n width: auto;\n}\n.calendar .calendar-header .year-neighbor {\n opacity: 0.4;\n}\n@media (max-width: 991px) {\n .calendar .calendar-header .year-neighbor {\n display: none;\n }\n}\n.calendar .calendar-header .year-neighbor2 {\n opacity: 0.2;\n}\n@media (max-width: 767px) {\n .calendar .calendar-header .year-neighbor2 {\n display: none;\n }\n}\n.calendar .months-container {\n width: 100%;\n display: none;\n}\n.calendar .months-container .month-container {\n float: left;\n text-align: center;\n height: 200px;\n padding: 0;\n}\n.calendar .months-container .month-container.month-2 {\n width: 16.66666667%;\n}\n.calendar .months-container .month-container.month-3 {\n width: 25%;\n}\n.calendar .months-container .month-container.month-4 {\n width: 33.33333333%;\n}\n.calendar .months-container .month-container.month-6 {\n width: 50%;\n}\n.calendar .months-container .month-container.month-12 {\n width: 100%;\n}\n.calendar table.month th.month-title {\n font-size: 16px;\n padding-bottom: 5px;\n}\n.calendar table.month th.day-header {\n font-size: 14px;\n}\n.calendar table.month tr td,\n.calendar table.month tr th {\n padding: 0;\n}\n.calendar table.month tr td.hidden,\n.calendar table.month tr th.hidden {\n display: none;\n}\n.calendar table.month td.week-number {\n cursor: default;\n font-weight: bold;\n border-right: 1px solid #eee;\n padding: 5px;\n}\n.calendar table.month td.day.round-left {\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n border-radius: 8px 0 0 8px;\n}\n.calendar table.month td.day.round-right {\n webkit-border-radius: 0 8px 8px 0 ;\n -moz-border-radius: 0 8px 8px 0;\n border-radius: 0 8px 8px 0;\n}\n.calendar table.month td.day .day-content {\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n padding: 5px 6px;\n}\n.calendar table.month td.old,\n.calendar table.month td.new,\n.calendar table.month td.old:hover,\n.calendar table.month td.new:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.disabled,\n.calendar table.month td.disabled:hover {\n color: #dddddd;\n}\n.calendar table.month td.disabled .day-content:hover,\n.calendar table.month td.disabled:hover .day-content:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.range .day-content {\n background: rgba(0, 0, 0, 0.2);\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n}\n.calendar table.month td.range.range-start .day-content {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.calendar table.month td.range.range-end .day-content {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.calendar .calendar-loading-container {\n position: relative;\n text-align: center;\n min-height: 200px;\n}\n.calendar .calendar-loading-container .calendar-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}\n.calendar .calendar-spinner {\n margin: 20px auto;\n width: 80px;\n text-align: center;\n}\n.calendar .calendar-spinner > div {\n width: 16px;\n height: 16px;\n margin: 5px;\n background-color: #333;\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: sk-bouncedelay 1s infinite ease-in-out both;\n animation: sk-bouncedelay 1s infinite ease-in-out both;\n}\n.calendar .calendar-spinner > div.bounce1 {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s;\n}\n.calendar .calendar-spinner > div.bounce2 {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s;\n}\n/* Context menu */\n.calendar-context-menu,\n.calendar-context-menu .submenu {\n border: 1px solid #ddd;\n background-color: white;\n box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n position: absolute;\n display: none;\n}\n.calendar-context-menu .item {\n position: relative;\n}\n.calendar-context-menu .item .content {\n padding: 5px 10px;\n cursor: pointer;\n display: table;\n width: 100%;\n white-space: nowrap;\n}\n.calendar-context-menu .item .content:hover {\n background: #eee;\n}\n.calendar-context-menu .item .content .text {\n display: table-cell;\n}\n.calendar-context-menu .item .content .arrow {\n display: table-cell;\n padding-left: 10px;\n text-align: right;\n}\n.calendar-context-menu .item .submenu {\n top: -1px;\n /* Compensate for the border */\n}\n.calendar-context-menu .item .submenu:not(.open-left) {\n left: 100%;\n}\n.calendar-context-menu .item .submenu.open-left {\n right: 100%;\n}\n.calendar-context-menu .item:hover > .submenu {\n display: block;\n}\n.table-striped .calendar table.month tr td,\n.table-striped .calendar table.month tr th {\n background-color: transparent;\n}\ntable.month td.day .day-content:hover {\n background: rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n@-webkit-keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n }\n}\n@keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n}\n';styleInject(css_248z);var Calendar=function(){_inherits(n,React.Component);var t=_createSuper(n);function n(e){return _classCallCheck(this,n),t.call(this,e)}return _createClass(n,[{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:"compare",value:function(t,n){var a=this;if("function"==typeof t&&"function"==typeof n)return t.toString()!=n.toString();if(t instanceof Date&&n instanceof Date)return t.getTime()!=n.getTime();if(null===t||"object"!==_typeof(t)||null===n||"object"!==_typeof(n))return t!=n;var e=Object.keys(t),r=Object.keys(n);return e.length!==r.length||e.some(function(e){return a.compare(t[e],n[e])})}},{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=[];this.compare(e.allowOverlap,this.props.allowOverlap)&&n.push(function(){return t.setAllowOverlap(e.allowOverlap)}),this.compare(e.alwaysHalfDay,this.props.alwaysHalfDay)&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!0)}),this.compare(e.contextMenuItems,this.props.contextMenuItems)&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!0)}),this.compare(e.customDayRenderer,this.props.customDayRenderer)&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!0)}),this.compare(e.customDataSourceRenderer,this.props.customDataSourceRenderer)&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!0)}),this.compare(e.dataSource,this.props.dataSource)&&n.push(function(){return t.setDataSource(e.dataSource,!0)}),this.compare(e.disabledDays,this.props.disabledDays)&&n.push(function(){return t.setDisabledDays(e.disabledDays,!0)}),this.compare(e.disabledWeekDays,this.props.disabledWeekDays)&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!0)}),this.compare(e.displayDisabledDataSource,this.props.displayDisabledDataSource)&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!0)}),this.compare(e.displayHeader,this.props.displayHeader)&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!0)}),this.compare(e.displayWeekNumber,this.props.displayWeekNumber)&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!0)}),this.compare(e.enableContextMenu,this.props.enableContextMenu)&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!0)}),this.compare(e.enableRangeSelection,this.props.enableRangeSelection)&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!0)}),this.compare(e.hiddenWeekDays,this.props.hiddenWeekDays)&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!0)}),this.compare(e.language,this.props.language)&&n.push(function(){return t.setLanguage(e.language,!0)}),this.compare(e.loadingTemplate,this.props.loadingTemplate)&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!0)}),this.compare(e.maxDate,this.props.maxDate)&&n.push(function(){return t.setMaxDate(e.maxDate,!0)}),this.compare(e.minDate,this.props.minDate)&&n.push(function(){return t.setMinDate(e.minDate,!0)}),this.compare(e.roundRangeLimits,this.props.roundRangeLimits)&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!0)}),this.compare(e.style,this.props.style)&&n.push(function(){return t.setStyle(e.style,!0)}),this.compare(e.weekStart,this.props.weekStart)&&n.push(function(){return t.setWeekStart(e.weekStart,!0)}),this.compare(e.year,this.props.year)&&n.push(function(){return t.setYear(e.year)}),this.compare(e.onDayClick,this.props.onDayClick)&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),this.compare(e.onDayContextMenu,this.props.onDayContextMenu)&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),this.compare(e.onDayEnter,this.props.onDayEnter)&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),this.compare(e.onDayLeave,this.props.onDayLeave)&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),this.compare(e.onRenderEnd,this.props.onRenderEnd)&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),this.compare(e.onRangeSelected,this.props.onRangeSelected)&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),this.compare(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}})}}]),n}();_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}),_defineProperty(Calendar,"locales",JsCalendar.locales),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){return(o="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 s(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 t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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}function c(a){return function(){var e,t=r(a);if(function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(e){return}}}()){var n=r(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return d(this,e)}}i=i&&i.hasOwnProperty("default")?i.default:i,e=e&&e.hasOwnProperty("default")?e.default:e;var n,a,u=(function(e){!function(e){function t(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){t=function e(t){return typeof t}}else{t=function e(t){return t&&typeof Symbol==="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}}return t(e)}function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||false;a.configurable=true;if("value"in a)a.writable=true;Object.defineProperty(e,a.key,a)}}function r(e,t,n){if(t)a(e.prototype,t);if(n)a(e,n);return e}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}if(Object.defineProperty(e,"__esModule",{value:true}),e["default"]=void 0,typeof NodeList!=="undefined"&&!NodeList.prototype.forEach){NodeList.prototype.forEach=function(e,t){t=t||window;for(var n=0;n<this.length;n++){e.call(t,this[n],n,this)}}}if(typeof Element!=="undefined"&&!Element.prototype.matches){var o=Element.prototype;Element.prototype.matches=o.msMatchesSelector||o.webkitMatchesSelector}if(typeof Element!=="undefined"&&!Element.prototype.closest){Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType==1);return null}}var s=function(){function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;n(this,D);i(this,"element",void 0);i(this,"options",void 0);i(this,"_dataSource",void 0);i(this,"_mouseDown",void 0);i(this,"_rangeStart",void 0);i(this,"_rangeEnd",void 0);i(this,"_responsiveInterval",void 0);i(this,"_nbCols",void 0);i(this,"clickDay",void 0);i(this,"dayContextMenu",void 0);i(this,"mouseOnDay",void 0);i(this,"mouseOutDay",void 0);i(this,"renderEnd",void 0);i(this,"selectRange",void 0);i(this,"yearChanged",void 0);if(e instanceof HTMLElement){this.element=e}else if(typeof e==="string"){this.element=document.querySelector(e)}else{throw new Error("The element parameter should be a DOM node or a selector")}this.element.classList.add("calendar");this._initializeEvents(t);this._initializeOptions(t);this.setYear(this.options.startYear)}r(D,[{key:"_initializeOptions",value:function e(t){if(t==null){t={}}this.options={startYear:!isNaN(parseInt(t.startYear))?parseInt(t.startYear):(new Date).getFullYear(),minDate:t.minDate instanceof Date?t.minDate:null,maxDate:t.maxDate instanceof Date?t.maxDate:null,language:t.language!=null&&D.locales[t.language]!=null?t.language:"en",allowOverlap:t.allowOverlap!=null?t.allowOverlap:true,displayWeekNumber:t.displayWeekNumber!=null?t.displayWeekNumber:false,displayDisabledDataSource:t.displayDisabledDataSource!=null?t.displayDisabledDataSource:false,displayHeader:t.displayHeader!=null?t.displayHeader:true,alwaysHalfDay:t.alwaysHalfDay!=null?t.alwaysHalfDay:false,enableRangeSelection:t.enableRangeSelection!=null?t.enableRangeSelection:false,disabledDays:t.disabledDays instanceof Array?t.disabledDays:[],disabledWeekDays:t.disabledWeekDays instanceof Array?t.disabledWeekDays:[],hiddenWeekDays:t.hiddenWeekDays instanceof Array?t.hiddenWeekDays:[],roundRangeLimits:t.roundRangeLimits!=null?t.roundRangeLimits:false,dataSource:t.dataSource instanceof Array||typeof t.dataSource==="function"?t.dataSource:[],style:t.style=="background"||t.style=="border"||t.style=="custom"?t.style:"border",enableContextMenu:t.enableContextMenu!=null?t.enableContextMenu:false,contextMenuItems:t.contextMenuItems instanceof Array?t.contextMenuItems:[],customDayRenderer:typeof t.customDayRenderer==="function"?t.customDayRenderer:null,customDataSourceRenderer:typeof t.customDataSourceRenderer==="function"?t.customDataSourceRenderer:null,weekStart:!isNaN(parseInt(t.weekStart))?parseInt(t.weekStart):null,loadingTemplate:typeof t.loadingTemplate==="string"||t.loadingTemplate instanceof HTMLElement?t.loadingTemplate:null};if(this.options.dataSource instanceof Array){this._dataSource=this.options.dataSource;this._initializeDatasourceColors()}}},{key:"_initializeEvents",value:function e(t){if(t==null){t=[]}if(t.yearChanged){this.element.addEventListener("yearChanged",t.yearChanged)}if(t.renderEnd){this.element.addEventListener("renderEnd",t.renderEnd)}if(t.clickDay){this.element.addEventListener("clickDay",t.clickDay)}if(t.dayContextMenu){this.element.addEventListener("dayContextMenu",t.dayContextMenu)}if(t.selectRange){this.element.addEventListener("selectRange",t.selectRange)}if(t.mouseOnDay){this.element.addEventListener("mouseOnDay",t.mouseOnDay)}if(t.mouseOutDay){this.element.addEventListener("mouseOutDay",t.mouseOutDay)}}},{key:"_fetchDataSource",value:function e(t){if(typeof this.options.dataSource==="function"){var n=this.options.dataSource;if(n.length==2){n(this.options.startYear,t)}else{var a=n(this.options.startYear);if(a instanceof Array){t(a)}else{a.then(t)}}}else{t(this.options.dataSource)}}},{key:"_initializeDatasourceColors",value:function e(){for(var t=0;t<this._dataSource.length;t++){if(this._dataSource[t].color==null){this._dataSource[t].color=D.colors[t%D.colors.length]}}}},{key:"render",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}if(t){this._renderLoading()}else{this._renderBody();this._renderDataSource();this._applyEvents();var n=this.element.querySelector(".months-container");n.style.opacity="0";n.style.display="block";n.style.transition="opacity 0.5s";setTimeout(function(){n.style.opacity="1";setTimeout(function(){return n.style.transition=""},500)},0);this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function e(){var t=document.createElement("div");t.classList.add("calendar-header");var n=document.createElement("table");var a=document.createElement("th");a.classList.add("prev");if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){a.classList.add("disabled")}var r=document.createElement("span");r.innerHTML="‹";a.appendChild(r);n.appendChild(a);var i=document.createElement("th");i.classList.add("year-title");i.classList.add("year-neighbor2");i.textContent=(this.options.startYear-2).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-2,11,31)){i.classList.add("disabled")}n.appendChild(i);var o=document.createElement("th");o.classList.add("year-title");o.classList.add("year-neighbor");o.textContent=(this.options.startYear-1).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){o.classList.add("disabled")}n.appendChild(o);var s=document.createElement("th");s.classList.add("year-title");s.textContent=this.options.startYear.toString();n.appendChild(s);var l=document.createElement("th");l.classList.add("year-title");l.classList.add("year-neighbor");l.textContent=(this.options.startYear+1).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){l.classList.add("disabled")}n.appendChild(l);var d=document.createElement("th");d.classList.add("year-title");d.classList.add("year-neighbor2");d.textContent=(this.options.startYear+2).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+2,0,1)){d.classList.add("disabled")}n.appendChild(d);var c=document.createElement("th");c.classList.add("next");if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){c.classList.add("disabled")}var u=document.createElement("span");u.innerHTML="›";c.appendChild(u);n.appendChild(c);t.appendChild(n);this.element.appendChild(t)}},{key:"_renderBody",value:function e(){var t=document.createElement("div");t.classList.add("months-container");for(var n=0;n<12;n++){var a=document.createElement("div");a.classList.add("month-container");a.dataset.monthId=n.toString();if(this._nbCols){a.classList.add("month-".concat(this._nbCols))}var r=new Date(this.options.startYear,n,1);var i=document.createElement("table");i.classList.add("month");var o=document.createElement("thead");var s=document.createElement("tr");var l=document.createElement("th");l.classList.add("month-title");l.setAttribute("colspan",this.options.displayWeekNumber?"8":"7");l.textContent=D.locales[this.options.language].months[n];s.appendChild(l);o.appendChild(s);var d=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("th");c.classList.add("week-number");c.textContent=D.locales[this.options.language].weekShort;d.appendChild(c)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart;var h=u;do{var p=document.createElement("th");p.classList.add("day-header");p.textContent=D.locales[this.options.language].daysMin[h];if(this._isHidden(h)){p.classList.add("hidden")}d.appendChild(p);h++;if(h>=7)h=0}while(h!=u);o.appendChild(d);i.appendChild(o);var f=new Date(r.getTime());var y=new Date(this.options.startYear,n+1,0);while(f.getDay()!=u){f.setDate(f.getDate()-1)}while(f<=y){var m=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("td");var g=new Date(f.getTime());g.setDate(g.getDate()-u+4);c.classList.add("week-number");c.textContent=this.getWeekNumber(g).toString();m.appendChild(c)}do{var v=document.createElement("td");v.classList.add("day");if(this._isHidden(f.getDay())){v.classList.add("hidden")}if(f<r){v.classList.add("old")}else if(f>y){v.classList.add("new")}else{if(this._isDisabled(f)){v.classList.add("disabled")}var b=document.createElement("div");b.classList.add("day-content");b.textContent=f.getDate().toString();v.appendChild(b);if(this.options.customDayRenderer){this.options.customDayRenderer(b,f)}}m.appendChild(v);f.setDate(f.getDate()+1)}while(f.getDay()!=u);i.appendChild(m)}a.appendChild(i);t.appendChild(a)}this.element.appendChild(t)}},{key:"_renderLoading",value:function e(){var t=document.createElement("div");t.classList.add("calendar-loading-container");t.style.minHeight=this._nbCols*200+"px";var n=document.createElement("div");n.classList.add("calendar-loading");if(this.options.loadingTemplate){if(typeof this.options.loadingTemplate==="string"){n.innerHTML=this.options.loadingTemplate}else if(this.options.loadingTemplate instanceof HTMLElement){n.appendChild(this.options.loadingTemplate)}}else{var a=document.createElement("div");a.classList.add("calendar-spinner");for(var r=1;r<=3;r++){var i=document.createElement("div");i.classList.add("bounce".concat(r));a.appendChild(i)}n.appendChild(a)}t.appendChild(n);this.element.appendChild(t)}},{key:"_renderDataSource",value:function e(){var s=this;if(this._dataSource!=null&&this._dataSource.length>0){this.element.querySelectorAll(".month-container").forEach(function(e){var i=parseInt(e.dataset.monthId);var t=new Date(s.options.startYear,i,1);var n=new Date(s.options.startYear,i+1,1);if((s.options.minDate==null||n>s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){var o=[];for(var a=0;a<s._dataSource.length;a++){if(!(s._dataSource[a].startDate>=n)||s._dataSource[a].endDate<t){o.push(s._dataSource[a])}}if(o.length>0){e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(s.options.startYear,i,parseInt(e.textContent));var n=new Date(s.options.startYear,i,t.getDate()+1);var a=[];if((s.options.minDate==null||t>=s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){for(var r=0;r<o.length;r++){if(o[r].startDate<n&&o[r].endDate>=t){a.push(o[r])}}if(a.length>0&&(s.options.displayDisabledDataSource||!s._isDisabled(t))){s._renderDataSourceDay(e,t,a)}}})}}})}}},{key:"_renderDataSourceDay",value:function e(t,n,a){var r=t.parentElement;switch(this.options.style){case"border":var i=0;if(a.length==1){i=4}else if(a.length<=3){i=2}else{r.style.boxShadow="inset 0 -4px 0 0 black"}if(i>0){var o="";for(var s=0;s<a.length;s++){if(o!=""){o+=","}o+="inset 0 -".concat((s+1)*i,"px 0 0 ").concat(a[s].color)}r.style.boxShadow=o}break;case"background":r.style.backgroundColor=a[a.length-1].color;var l=n.getTime();if(a[a.length-1].startDate.getTime()==l){r.classList.add("day-start");if(a[a.length-1].startHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].startDate.getTime()!=l||!a[s].startHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(-45deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-left")}}else if(a[a.length-1].endDate.getTime()==l){r.classList.add("day-end");if(a[a.length-1].endHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].endDate.getTime()!=l||!a[s].endHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(135deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-right")}}break;case"custom":if(this.options.customDataSourceRenderer){this.options.customDataSourceRenderer.call(this,t,n,a)}break}}},{key:"_applyEvents",value:function e(){var i=this;if(this.options.displayHeader){this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){if(!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 t=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");t.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){if(i.options.enableContextMenu){e.preventDefault();if(i.options.contextMenuItems.length>0){i._openContextMenu(e.currentTarget)}}var t=i._getDate(e.currentTarget);i._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:i.getEvents(t)})});if(i.options.enableRangeSelection){e.addEventListener("mousedown",function(e){if(e.which==1){var t=i._getDate(e.currentTarget);if(i.options.allowOverlap||i.isThereFreeSlot(t)){i._mouseDown=true;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){var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);while(n<t){if(!i.isThereFreeSlot(a,false)){break}n.setDate(n.getDate()+1);a.setDate(a.getDate()+1)}}else{var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);while(n>t){if(!i.isThereFreeSlot(a,true)){break}n.setDate(n.getDate()-1);a.setDate(a.getDate()-1)}}t=n}var r=i._rangeEnd;i._rangeEnd=t;if(r.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)})})});if(this.options.enableRangeSelection){window.addEventListener("mouseup",function(e){if(i._mouseDown){i._mouseDown=false;i._refreshRange();var t=i._rangeStart<i._rangeEnd?i._rangeStart:i._rangeEnd;var 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))})}})}if(this._responsiveInterval){clearInterval(this._responsiveInterval);this._responsiveInterval=null}this._responsiveInterval=setInterval(function(){if(i.element.querySelector(".month")==null){return}var e=i.element.offsetWidth;var t=i.element.querySelector(".month").offsetWidth+10;i._nbCols=null;if(t*6<e){i._nbCols=2}else if(t*4<e){i._nbCols=3}else if(t*3<e){i._nbCols=4}else if(t*2<e){i._nbCols=6}else{i._nbCols=12}i.element.querySelectorAll(".month-container").forEach(function(t){if(!t.classList.contains("month-".concat(i._nbCols))){["month-2","month-3","month-4","month-6","month-12"].forEach(function(e){t.classList.remove(e)});t.classList.add("month-".concat(i._nbCols))}})},300)}},{key:"_refreshRange",value:function e(){var n=this;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")});if(this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd;var r=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);if(a.getMonth()<=t&&r.getMonth()>=t){e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);if(t>=a&&t<=r){e.classList.add("range");if(t.getTime()==a.getTime()){e.classList.add("range-start")}if(t.getTime()==r.getTime()){e.classList.add("range-end")}}})}})}}},{key:"_getElementPosition",value:function e(t){var n=0,a=0;do{n+=t.offsetTop||0;a+=t.offsetLeft||0;t=t.offsetParent}while(t);return{top:n,left:a}}},{key:"_openContextMenu",value:function e(t){var n=document.querySelector(".calendar-context-menu");if(n!==null){n.style.display="none";while(n.firstChild){n.removeChild(n.firstChild)}}else{n=document.createElement("div");n.classList.add("calendar-context-menu");document.body.appendChild(n)}var a=this._getDate(t);var r=this.getEvents(a);for(var i=0;i<r.length;i++){var o=document.createElement("div");o.classList.add("item");o.style.borderLeft="4px solid ".concat(r[i].color);var s=document.createElement("div");s.classList.add("content");var l=document.createElement("span");l.classList.add("text");l.textContent=r[i].name;s.appendChild(l);var d=document.createElement("span");d.classList.add("arrow");d.innerHTML="›";s.appendChild(d);o.appendChild(s);this._renderContextMenuItems(o,this.options.contextMenuItems,r[i]);n.appendChild(o)}if(n.children.length>0){var c=this._getElementPosition(t);n.style.left=c.left+25+"px";n.style.top=c.top+25+"px";n.style.display="block";window.addEventListener("click",function(e){if(!n.contains(e.target)){n.style.display="none"}},{once:true})}}},{key:"_renderContextMenuItems",value:function e(t,n,a){var r=document.createElement("div");r.classList.add("submenu");for(var i=0;i<n.length;i++){if(n[i].visible===false||typeof n[i].visible==="function"&&!n[i].visible(a)){continue}var o=document.createElement("div");o.classList.add("item");var s=document.createElement("div");s.classList.add("content");var l=document.createElement("span");l.classList.add("text");l.textContent=n[i].text;s.appendChild(l);if(n[i].click){(function(e){s.addEventListener("click",function(){document.querySelector(".calendar-context-menu").style.display="none";n[e].click(a)})})(i)}o.appendChild(s);if(n[i].items&&n[i].items.length>0){var d=document.createElement("span");d.classList.add("arrow");d.innerHTML="›";s.appendChild(d);this._renderContextMenuItems(o,n[i].items,a)}r.appendChild(o)}if(r.children.length>0){t.appendChild(r)}}},{key:"_getDate",value:function e(t){var n=t.querySelector(".day-content").textContent;var a=t.closest(".month-container").dataset.monthId;var r=this.options.startYear;return new Date(r,a,n)}},{key:"_triggerEvent",value:function e(t,n){var a=null;if(typeof Event==="function"){a=new Event(t)}else{a=document.createEvent("Event");a.initEvent(t,false,false)}a.calendar=this;for(var r in n){a[r]=n[r]}this.element.dispatchEvent(a);return a}},{key:"_isDisabled",value:function e(t){if(this.options.minDate!=null&&t<this.options.minDate||this.options.maxDate!=null&&t>this.options.maxDate){return true}if(this.options.disabledWeekDays.length>0){for(var n=0;n<this.options.disabledWeekDays.length;n++){if(t.getDay()==this.options.disabledWeekDays[n]){return true}}}if(this.options.disabledDays.length>0){for(var n=0;n<this.options.disabledDays.length;n++){if(t.getTime()==this.options.disabledDays[n].getTime()){return true}}}return false}},{key:"_isHidden",value:function e(t){if(this.options.hiddenWeekDays.length>0){for(var n=0;n<this.options.hiddenWeekDays.length;n++){if(t==this.options.hiddenWeekDays[n]){return true}}}return false}},{key:"getWeekNumber",value:function e(t){var n=new Date(t.getTime());n.setHours(0,0,0,0);n.setDate(n.getDate()+3-(n.getDay()+6)%7);var a=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-a.getTime())/864e5-3+(a.getDay()+6)%7)/7)}},{key:"getEvents",value:function e(t){return this.getEventsOnRange(t,new Date(t.getFullYear(),t.getMonth(),t.getDate()+1))}},{key:"getEventsOnRange",value:function e(t,n){var a=[];if(this._dataSource&&t&&n){for(var r=0;r<this._dataSource.length;r++){if(this._dataSource[r].startDate<n&&this._dataSource[r].endDate>=t){a.push(this._dataSource[r])}}}return a}},{key:"isThereFreeSlot",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=this.getEvents(t);if(a===true){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.endHalfDay||e.endDate>t})}else if(a===false){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.startHalfDay||e.startDate<t})}else{return this.isThereFreeSlot(t,false)||this.isThereFreeSlot(t,true)}}},{key:"getYear",value:function e(){return this.options.startYear}},{key:"setYear",value:function e(t){var n=this;var a=parseInt(t);if(!isNaN(a)){this.options.startYear=a;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}var r=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:false});if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{if(!r.preventRendering){this.render()}}}}},{key:"getMinDate",value:function e(){return this.options.minDate}},{key:"setMinDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.minDate=t;if(!n){this.render()}}}},{key:"getMaxDate",value:function e(){return this.options.maxDate}},{key:"setMaxDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.maxDate=t;if(!n){this.render()}}}},{key:"getStyle",value:function e(){return this.options.style}},{key:"setStyle",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.style=t=="background"||t=="border"||t=="custom"?t:"border";if(!n){this.render()}}},{key:"getAllowOverlap",value:function e(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function e(t){this.options.allowOverlap=t}},{key:"getDisplayWeekNumber",value:function e(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayWeekNumber=t;if(!n){this.render()}}},{key:"getDisplayHeader",value:function e(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayHeader=t;if(!n){this.render()}}},{key:"getDisplayDisabledDataSource",value:function e(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayDisabledDataSource=t;if(!n){this.render()}}},{key:"getAlwaysHalfDay",value:function e(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.alwaysHalfDay=t;if(!n){this.render()}}},{key:"getEnableRangeSelection",value:function e(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableRangeSelection=t;if(!n){this.render()}}},{key:"getDisabledDays",value:function e(){return this.options.disabledDays}},{key:"setDisabledDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getDisabledWeekDays",value:function e(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getHiddenWeekDays",value:function e(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.hiddenWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getRoundRangeLimits",value:function e(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.roundRangeLimits=t;if(!n){this.render()}}},{key:"getEnableContextMenu",value:function e(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableContextMenu=t;if(!n){this.render()}}},{key:"getContextMenuItems",value:function e(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.contextMenuItems=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getCustomDayRenderer",value:function e(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDayRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getCustomDataSourceRenderer",value:function e(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDataSourceRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getLanguage",value:function e(){return this.options.language}},{key:"setLanguage",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t!=null&&D.locales[t]!=null){this.options.language=t;if(!n){this.render()}}}},{key:"getDataSource",value:function e(){return this.options.dataSource}},{key:"setDataSource",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.dataSource=t instanceof Array||typeof t==="function"?t:[];if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{this._dataSource=this.options.dataSource;this._initializeDatasourceColors();if(!a){this.render()}}}},{key:"getWeekStart",value:function e(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.weekStart=!isNaN(parseInt(t))?parseInt(t):null;if(!n){this.render()}}},{key:"getLoadingTemplate",value:function e(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function e(t){this.options.loadingTemplate=typeof t==="string"||t instanceof HTMLElement?t:null}},{key:"addEvent",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this._dataSource.push(t);if(!n){this.render()}}}]);return D}();if(i(e["default"]=s,"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}}),i(s,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),(typeof window==="undefined"?"undefined":t(window))==="object"){window.Calendar=s;document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new s(e)})})}}(e)}((n={exports:{}},n.exports)),n.exports),h=(a=u)&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}('/* =========================================================\n * JS year calendar v0.1.0\n * Repo: https://github.com/year-calendar/js-year-calendar\n * =========================================================\n * Created by Paul David-Sivelle\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================= */\n/* Main */\n.calendar {\n padding: 4px;\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n direction: ltr;\n overflow-x: hidden;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n /* Header */\n /* Months */\n /* Loading */\n}\n.calendar:after {\n /* Apply the right height on the calendar div, even if the months elements are floating */\n clear: both;\n content: "";\n display: block;\n}\n.calendar .calendar-rtl {\n direction: rtl;\n}\n.calendar .calendar-rtl .calendar-rtl table tr td span {\n float: right;\n}\n.calendar table {\n margin: auto;\n border-spacing: 0;\n}\n.calendar table td,\n.calendar table th {\n text-align: center;\n width: 20px;\n height: 20px;\n border: none;\n padding: 4px 5px;\n font-size: 12px;\n}\n.calendar .calendar-header {\n width: 100%;\n margin-bottom: 20px;\n border: 1px solid #ddd;\n}\n.calendar .calendar-header table {\n width: 100%;\n}\n.calendar .calendar-header table th {\n font-size: 22px;\n padding: 5px 10px;\n cursor: pointer;\n}\n.calendar .calendar-header table th:hover {\n background: #eeeeee;\n}\n.calendar .calendar-header table th.disabled,\n.calendar .calendar-header table th.disabled:hover {\n background: none;\n cursor: default;\n color: white;\n}\n.calendar .calendar-header table th.prev,\n.calendar .calendar-header table th.next {\n width: 20px;\n}\n.calendar .calendar-header .year-title {\n font-weight: bold;\n text-align: center;\n height: 20px;\n width: auto;\n}\n.calendar .calendar-header .year-neighbor {\n opacity: 0.4;\n}\n@media (max-width: 991px) {\n .calendar .calendar-header .year-neighbor {\n display: none;\n }\n}\n.calendar .calendar-header .year-neighbor2 {\n opacity: 0.2;\n}\n@media (max-width: 767px) {\n .calendar .calendar-header .year-neighbor2 {\n display: none;\n }\n}\n.calendar .months-container {\n width: 100%;\n display: none;\n}\n.calendar .months-container .month-container {\n float: left;\n text-align: center;\n height: 200px;\n padding: 0;\n}\n.calendar .months-container .month-container.month-2 {\n width: 16.66666667%;\n}\n.calendar .months-container .month-container.month-3 {\n width: 25%;\n}\n.calendar .months-container .month-container.month-4 {\n width: 33.33333333%;\n}\n.calendar .months-container .month-container.month-6 {\n width: 50%;\n}\n.calendar .months-container .month-container.month-12 {\n width: 100%;\n}\n.calendar table.month th.month-title {\n font-size: 16px;\n padding-bottom: 5px;\n}\n.calendar table.month th.day-header {\n font-size: 14px;\n}\n.calendar table.month tr td,\n.calendar table.month tr th {\n padding: 0;\n}\n.calendar table.month tr td.hidden,\n.calendar table.month tr th.hidden {\n display: none;\n}\n.calendar table.month td.week-number {\n cursor: default;\n font-weight: bold;\n border-right: 1px solid #eee;\n padding: 5px;\n}\n.calendar table.month td.day.round-left {\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n border-radius: 8px 0 0 8px;\n}\n.calendar table.month td.day.round-right {\n webkit-border-radius: 0 8px 8px 0 ;\n -moz-border-radius: 0 8px 8px 0;\n border-radius: 0 8px 8px 0;\n}\n.calendar table.month td.day .day-content {\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n padding: 5px 6px;\n}\n.calendar table.month td.old,\n.calendar table.month td.new,\n.calendar table.month td.old:hover,\n.calendar table.month td.new:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.disabled,\n.calendar table.month td.disabled:hover {\n color: #dddddd;\n}\n.calendar table.month td.disabled .day-content:hover,\n.calendar table.month td.disabled:hover .day-content:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.range .day-content {\n background: rgba(0, 0, 0, 0.2);\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n}\n.calendar table.month td.range.range-start .day-content {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.calendar table.month td.range.range-end .day-content {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.calendar .calendar-loading-container {\n position: relative;\n text-align: center;\n min-height: 200px;\n}\n.calendar .calendar-loading-container .calendar-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}\n.calendar .calendar-spinner {\n margin: 20px auto;\n width: 80px;\n text-align: center;\n}\n.calendar .calendar-spinner > div {\n width: 16px;\n height: 16px;\n margin: 5px;\n background-color: #333;\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: sk-bouncedelay 1s infinite ease-in-out both;\n animation: sk-bouncedelay 1s infinite ease-in-out both;\n}\n.calendar .calendar-spinner > div.bounce1 {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s;\n}\n.calendar .calendar-spinner > div.bounce2 {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s;\n}\n/* Context menu */\n.calendar-context-menu,\n.calendar-context-menu .submenu {\n border: 1px solid #ddd;\n background-color: white;\n box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n position: absolute;\n display: none;\n}\n.calendar-context-menu .item {\n position: relative;\n}\n.calendar-context-menu .item .content {\n padding: 5px 10px;\n cursor: pointer;\n display: table;\n width: 100%;\n white-space: nowrap;\n}\n.calendar-context-menu .item .content:hover {\n background: #eee;\n}\n.calendar-context-menu .item .content .text {\n display: table-cell;\n}\n.calendar-context-menu .item .content .arrow {\n display: table-cell;\n padding-left: 10px;\n text-align: right;\n}\n.calendar-context-menu .item .submenu {\n left: 100%;\n top: -1px;\n /* Compensate for the border */\n}\n.calendar-context-menu .item:hover > .submenu {\n display: block;\n}\n.table-striped .calendar table.month tr td,\n.table-striped .calendar table.month tr th {\n background-color: transparent;\n}\ntable.month td.day .day-content:hover {\n background: rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n@-webkit-keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n }\n}\n@keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n}\n');var p=function(){!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)}(r,i.Component);var e,t,n,a=c(r);function r(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),a.call(this,e)}return e=r,(t=[{key:"componentDidMount",value:function(){this.JsCalendar=new h(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:"compare",value:function(t,n){var a=this;if("function"==typeof t&&"function"==typeof n)return t.toString()!=n.toString();if(t instanceof Date&&n instanceof Date)return t.getTime()!=n.getTime();if(null===t||"object"!==o(t)||null===n||"object"!==o(n))return t!=n;var e=Object.keys(t),r=Object.keys(t);return e.length!==r.length||e.some(function(e){return a.compare(t[e],n[e])})}},{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=[];this.compare(e.allowOverlap,this.props.allowOverlap)&&n.push(function(){return t.setAllowOverlap(e.allowOverlap)}),this.compare(e.alwaysHalfDay,this.props.alwaysHalfDay)&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!0)}),this.compare(e.contextMenuItems,this.props.contextMenuItems)&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!0)}),this.compare(e.customDayRenderer,this.props.customDayRenderer)&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!0)}),this.compare(e.customDataSourceRenderer,this.props.customDataSourceRenderer)&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!0)}),this.compare(e.dataSource,this.props.dataSource)&&n.push(function(){return t.setDataSource(e.dataSource,!0)}),this.compare(e.disabledDays,this.props.disabledDays)&&n.push(function(){return t.setDisabledDays(e.disabledDays,!0)}),this.compare(e.disabledWeekDays,this.props.disabledWeekDays)&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!0)}),this.compare(e.displayDisabledDataSource,this.props.displayDisabledDataSource)&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!0)}),this.compare(e.displayHeader,this.props.displayHeader)&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!0)}),this.compare(e.displayWeekNumber,this.props.displayWeekNumber)&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!0)}),this.compare(e.enableContextMenu,this.props.enableContextMenu)&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!0)}),this.compare(e.enableRangeSelection,this.props.enableRangeSelection)&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!0)}),this.compare(e.hiddenWeekDays,this.props.hiddenWeekDays)&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!0)}),this.compare(e.language,this.props.language)&&n.push(function(){return t.setLanguage(e.language,!0)}),this.compare(e.loadingTemplate,this.props.loadingTemplate)&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!0)}),this.compare(e.maxDate,this.props.maxDate)&&n.push(function(){return t.setMaxDate(e.maxDate,!0)}),this.compare(e.minDate,this.props.minDate)&&n.push(function(){return t.setMinDate(e.minDate,!0)}),this.compare(e.roundRangeLimits,this.props.roundRangeLimits)&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!0)}),this.compare(e.style,this.props.style)&&n.push(function(){return t.setStyle(e.style,!0)}),this.compare(e.weekStart,this.props.weekStart)&&n.push(function(){return t.setWeekStart(e.weekStart,!0)}),this.compare(e.year,this.props.year)&&n.push(function(){return t.setYear(e.year)}),this.compare(e.onDayClick,this.props.onDayClick)&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),this.compare(e.onDayContextMenu,this.props.onDayContextMenu)&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),this.compare(e.onDayEnter,this.props.onDayEnter)&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),this.compare(e.onDayLeave,this.props.onDayLeave)&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),this.compare(e.onRenderEnd,this.props.onRenderEnd)&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),this.compare(e.onRangeSelected,this.props.onRangeSelected)&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),this.compare(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}})}}])&&s(e.prototype,t),n&&s(e,n),r}();return t(p,"propsTypes",{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}),t(p,"locales",h.locales),p},"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){return(o="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 s(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 t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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}function c(a){return function(){var e,t=r(a);if(function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(e){return}}}()){var n=r(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return d(this,e)}}i=i&&i.hasOwnProperty("default")?i.default:i,e=e&&e.hasOwnProperty("default")?e.default:e;var n,a,u=(function(e){!function(e){function t(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){t=function e(t){return typeof t}}else{t=function e(t){return t&&typeof Symbol==="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}}return t(e)}function n(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||false;a.configurable=true;if("value"in a)a.writable=true;Object.defineProperty(e,a.key,a)}}function r(e,t,n){if(t)a(e.prototype,t);if(n)a(e,n);return e}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}if(Object.defineProperty(e,"__esModule",{value:true}),e["default"]=void 0,typeof NodeList!=="undefined"&&!NodeList.prototype.forEach){NodeList.prototype.forEach=function(e,t){t=t||window;for(var n=0;n<this.length;n++){e.call(t,this[n],n,this)}}}if(typeof Element!=="undefined"&&!Element.prototype.matches){var o=Element.prototype;Element.prototype.matches=o.msMatchesSelector||o.webkitMatchesSelector}if(typeof Element!=="undefined"&&!Element.prototype.closest){Element.prototype.closest=function(e){var t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType==1);return null}}var s=function(){function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;n(this,D);i(this,"element",void 0);i(this,"options",void 0);i(this,"_dataSource",void 0);i(this,"_mouseDown",void 0);i(this,"_rangeStart",void 0);i(this,"_rangeEnd",void 0);i(this,"_responsiveInterval",void 0);i(this,"_nbCols",void 0);i(this,"clickDay",void 0);i(this,"dayContextMenu",void 0);i(this,"mouseOnDay",void 0);i(this,"mouseOutDay",void 0);i(this,"renderEnd",void 0);i(this,"selectRange",void 0);i(this,"yearChanged",void 0);if(e instanceof HTMLElement){this.element=e}else if(typeof e==="string"){this.element=document.querySelector(e)}else{throw new Error("The element parameter should be a DOM node or a selector")}this.element.classList.add("calendar");this._initializeEvents(t);this._initializeOptions(t);this.setYear(this.options.startYear)}r(D,[{key:"_initializeOptions",value:function e(t){if(t==null){t={}}this.options={startYear:!isNaN(parseInt(t.startYear))?parseInt(t.startYear):(new Date).getFullYear(),minDate:t.minDate instanceof Date?t.minDate:null,maxDate:t.maxDate instanceof Date?t.maxDate:null,language:t.language!=null&&D.locales[t.language]!=null?t.language:"en",allowOverlap:t.allowOverlap!=null?t.allowOverlap:true,displayWeekNumber:t.displayWeekNumber!=null?t.displayWeekNumber:false,displayDisabledDataSource:t.displayDisabledDataSource!=null?t.displayDisabledDataSource:false,displayHeader:t.displayHeader!=null?t.displayHeader:true,alwaysHalfDay:t.alwaysHalfDay!=null?t.alwaysHalfDay:false,enableRangeSelection:t.enableRangeSelection!=null?t.enableRangeSelection:false,disabledDays:t.disabledDays instanceof Array?t.disabledDays:[],disabledWeekDays:t.disabledWeekDays instanceof Array?t.disabledWeekDays:[],hiddenWeekDays:t.hiddenWeekDays instanceof Array?t.hiddenWeekDays:[],roundRangeLimits:t.roundRangeLimits!=null?t.roundRangeLimits:false,dataSource:t.dataSource instanceof Array||typeof t.dataSource==="function"?t.dataSource:[],style:t.style=="background"||t.style=="border"||t.style=="custom"?t.style:"border",enableContextMenu:t.enableContextMenu!=null?t.enableContextMenu:false,contextMenuItems:t.contextMenuItems instanceof Array?t.contextMenuItems:[],customDayRenderer:typeof t.customDayRenderer==="function"?t.customDayRenderer:null,customDataSourceRenderer:typeof t.customDataSourceRenderer==="function"?t.customDataSourceRenderer:null,weekStart:!isNaN(parseInt(t.weekStart))?parseInt(t.weekStart):null,loadingTemplate:typeof t.loadingTemplate==="string"||t.loadingTemplate instanceof HTMLElement?t.loadingTemplate:null};if(this.options.dataSource instanceof Array){this._dataSource=this.options.dataSource;this._initializeDatasourceColors()}}},{key:"_initializeEvents",value:function e(t){if(t==null){t=[]}if(t.yearChanged){this.element.addEventListener("yearChanged",t.yearChanged)}if(t.renderEnd){this.element.addEventListener("renderEnd",t.renderEnd)}if(t.clickDay){this.element.addEventListener("clickDay",t.clickDay)}if(t.dayContextMenu){this.element.addEventListener("dayContextMenu",t.dayContextMenu)}if(t.selectRange){this.element.addEventListener("selectRange",t.selectRange)}if(t.mouseOnDay){this.element.addEventListener("mouseOnDay",t.mouseOnDay)}if(t.mouseOutDay){this.element.addEventListener("mouseOutDay",t.mouseOutDay)}}},{key:"_fetchDataSource",value:function e(t){if(typeof this.options.dataSource==="function"){var n=this.options.dataSource;if(n.length==2){n(this.options.startYear,t)}else{var a=n(this.options.startYear);if(a instanceof Array){t(a)}else{a.then(t)}}}else{t(this.options.dataSource)}}},{key:"_initializeDatasourceColors",value:function e(){for(var t=0;t<this._dataSource.length;t++){if(this._dataSource[t].color==null){this._dataSource[t].color=D.colors[t%D.colors.length]}}}},{key:"render",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}if(t){this._renderLoading()}else{this._renderBody();this._renderDataSource();this._applyEvents();var n=this.element.querySelector(".months-container");n.style.opacity="0";n.style.display="block";n.style.transition="opacity 0.5s";setTimeout(function(){n.style.opacity="1";setTimeout(function(){return n.style.transition=""},500)},0);this._triggerEvent("renderEnd",{currentYear:this.options.startYear})}}},{key:"_renderHeader",value:function e(){var t=document.createElement("div");t.classList.add("calendar-header");var n=document.createElement("table");var a=document.createElement("th");a.classList.add("prev");if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){a.classList.add("disabled")}var r=document.createElement("span");r.innerHTML="‹";a.appendChild(r);n.appendChild(a);var i=document.createElement("th");i.classList.add("year-title");i.classList.add("year-neighbor2");i.textContent=(this.options.startYear-2).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-2,11,31)){i.classList.add("disabled")}n.appendChild(i);var o=document.createElement("th");o.classList.add("year-title");o.classList.add("year-neighbor");o.textContent=(this.options.startYear-1).toString();if(this.options.minDate!=null&&this.options.minDate>new Date(this.options.startYear-1,11,31)){o.classList.add("disabled")}n.appendChild(o);var s=document.createElement("th");s.classList.add("year-title");s.textContent=this.options.startYear.toString();n.appendChild(s);var l=document.createElement("th");l.classList.add("year-title");l.classList.add("year-neighbor");l.textContent=(this.options.startYear+1).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){l.classList.add("disabled")}n.appendChild(l);var d=document.createElement("th");d.classList.add("year-title");d.classList.add("year-neighbor2");d.textContent=(this.options.startYear+2).toString();if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+2,0,1)){d.classList.add("disabled")}n.appendChild(d);var c=document.createElement("th");c.classList.add("next");if(this.options.maxDate!=null&&this.options.maxDate<new Date(this.options.startYear+1,0,1)){c.classList.add("disabled")}var u=document.createElement("span");u.innerHTML="›";c.appendChild(u);n.appendChild(c);t.appendChild(n);this.element.appendChild(t)}},{key:"_renderBody",value:function e(){var t=document.createElement("div");t.classList.add("months-container");for(var n=0;n<12;n++){var a=document.createElement("div");a.classList.add("month-container");a.dataset.monthId=n.toString();if(this._nbCols){a.classList.add("month-".concat(this._nbCols))}var r=new Date(this.options.startYear,n,1);var i=document.createElement("table");i.classList.add("month");var o=document.createElement("thead");var s=document.createElement("tr");var l=document.createElement("th");l.classList.add("month-title");l.setAttribute("colspan",this.options.displayWeekNumber?"8":"7");l.textContent=D.locales[this.options.language].months[n];s.appendChild(l);o.appendChild(s);var d=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("th");c.classList.add("week-number");c.textContent=D.locales[this.options.language].weekShort;d.appendChild(c)}var u=this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart;var h=u;do{var p=document.createElement("th");p.classList.add("day-header");p.textContent=D.locales[this.options.language].daysMin[h];if(this._isHidden(h)){p.classList.add("hidden")}d.appendChild(p);h++;if(h>=7)h=0}while(h!=u);o.appendChild(d);i.appendChild(o);var f=new Date(r.getTime());var y=new Date(this.options.startYear,n+1,0);while(f.getDay()!=u){f.setDate(f.getDate()-1)}while(f<=y){var m=document.createElement("tr");if(this.options.displayWeekNumber){var c=document.createElement("td");var g=new Date(f.getTime());g.setDate(g.getDate()-u+4);c.classList.add("week-number");c.textContent=this.getWeekNumber(g).toString();m.appendChild(c)}do{var v=document.createElement("td");v.classList.add("day");if(this._isHidden(f.getDay())){v.classList.add("hidden")}if(f<r){v.classList.add("old")}else if(f>y){v.classList.add("new")}else{if(this._isDisabled(f)){v.classList.add("disabled")}var b=document.createElement("div");b.classList.add("day-content");b.textContent=f.getDate().toString();v.appendChild(b);if(this.options.customDayRenderer){this.options.customDayRenderer(b,f)}}m.appendChild(v);f.setDate(f.getDate()+1)}while(f.getDay()!=u);i.appendChild(m)}a.appendChild(i);t.appendChild(a)}this.element.appendChild(t)}},{key:"_renderLoading",value:function e(){var t=document.createElement("div");t.classList.add("calendar-loading-container");t.style.minHeight=this._nbCols*200+"px";var n=document.createElement("div");n.classList.add("calendar-loading");if(this.options.loadingTemplate){if(typeof this.options.loadingTemplate==="string"){n.innerHTML=this.options.loadingTemplate}else if(this.options.loadingTemplate instanceof HTMLElement){n.appendChild(this.options.loadingTemplate)}}else{var a=document.createElement("div");a.classList.add("calendar-spinner");for(var r=1;r<=3;r++){var i=document.createElement("div");i.classList.add("bounce".concat(r));a.appendChild(i)}n.appendChild(a)}t.appendChild(n);this.element.appendChild(t)}},{key:"_renderDataSource",value:function e(){var s=this;if(this._dataSource!=null&&this._dataSource.length>0){this.element.querySelectorAll(".month-container").forEach(function(e){var i=parseInt(e.dataset.monthId);var t=new Date(s.options.startYear,i,1);var n=new Date(s.options.startYear,i+1,1);if((s.options.minDate==null||n>s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){var o=[];for(var a=0;a<s._dataSource.length;a++){if(!(s._dataSource[a].startDate>=n)||s._dataSource[a].endDate<t){o.push(s._dataSource[a])}}if(o.length>0){e.querySelectorAll(".day-content").forEach(function(e){var t=new Date(s.options.startYear,i,parseInt(e.textContent));var n=new Date(s.options.startYear,i,t.getDate()+1);var a=[];if((s.options.minDate==null||t>=s.options.minDate)&&(s.options.maxDate==null||t<=s.options.maxDate)){for(var r=0;r<o.length;r++){if(o[r].startDate<n&&o[r].endDate>=t){a.push(o[r])}}if(a.length>0&&(s.options.displayDisabledDataSource||!s._isDisabled(t))){s._renderDataSourceDay(e,t,a)}}})}}})}}},{key:"_renderDataSourceDay",value:function e(t,n,a){var r=t.parentElement;switch(this.options.style){case"border":var i=0;if(a.length==1){i=4}else if(a.length<=3){i=2}else{r.style.boxShadow="inset 0 -4px 0 0 black"}if(i>0){var o="";for(var s=0;s<a.length;s++){if(o!=""){o+=","}o+="inset 0 -".concat((s+1)*i,"px 0 0 ").concat(a[s].color)}r.style.boxShadow=o}break;case"background":r.style.backgroundColor=a[a.length-1].color;var l=n.getTime();if(a[a.length-1].startDate.getTime()==l){r.classList.add("day-start");if(a[a.length-1].startHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].startDate.getTime()!=l||!a[s].startHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(-45deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-left")}}else if(a[a.length-1].endDate.getTime()==l){r.classList.add("day-end");if(a[a.length-1].endHalfDay||this.options.alwaysHalfDay){r.classList.add("day-half");var d="transparent";for(var s=a.length-2;s>=0;s--){if(a[s].endDate.getTime()!=l||!a[s].endHalfDay&&!this.options.alwaysHalfDay){d=a[s].color;break}}r.style.background="linear-gradient(135deg, ".concat(a[a.length-1].color,", ").concat(a[a.length-1].color," 49%, ").concat(d," 51%, ").concat(d,")")}else if(this.options.roundRangeLimits){r.classList.add("round-right")}}break;case"custom":if(this.options.customDataSourceRenderer){this.options.customDataSourceRenderer.call(this,t,n,a)}break}}},{key:"_applyEvents",value:function e(){var i=this;if(this.options.displayHeader){this.element.querySelectorAll(".year-neighbor, .year-neighbor2").forEach(function(e){e.addEventListener("click",function(e){if(!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 t=this.element.querySelectorAll(".day:not(.old):not(.new):not(.disabled)");t.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){if(i.options.enableContextMenu){e.preventDefault();if(i.options.contextMenuItems.length>0){i._openContextMenu(e.currentTarget)}}var t=i._getDate(e.currentTarget);i._triggerEvent("dayContextMenu",{element:e.currentTarget,date:t,events:i.getEvents(t)})});if(i.options.enableRangeSelection){e.addEventListener("mousedown",function(e){if(e.which==1){var t=i._getDate(e.currentTarget);if(i.options.allowOverlap||i.isThereFreeSlot(t)){i._mouseDown=true;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){var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);while(n<t){if(!i.isThereFreeSlot(a,false)){break}n.setDate(n.getDate()+1);a.setDate(a.getDate()+1)}}else{var a=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);while(n>t){if(!i.isThereFreeSlot(a,true)){break}n.setDate(n.getDate()-1);a.setDate(a.getDate()-1)}}t=n}var r=i._rangeEnd;i._rangeEnd=t;if(r.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)})})});if(this.options.enableRangeSelection){window.addEventListener("mouseup",function(e){if(i._mouseDown){i._mouseDown=false;i._refreshRange();var t=i._rangeStart<i._rangeEnd?i._rangeStart:i._rangeEnd;var 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))})}})}if(this._responsiveInterval){clearInterval(this._responsiveInterval);this._responsiveInterval=null}this._responsiveInterval=setInterval(function(){if(i.element.querySelector(".month")==null){return}var e=i.element.offsetWidth;var t=i.element.querySelector(".month").offsetWidth+10;i._nbCols=null;if(t*6<e){i._nbCols=2}else if(t*4<e){i._nbCols=3}else if(t*3<e){i._nbCols=4}else if(t*2<e){i._nbCols=6}else{i._nbCols=12}i.element.querySelectorAll(".month-container").forEach(function(t){if(!t.classList.contains("month-".concat(i._nbCols))){["month-2","month-3","month-4","month-6","month-12"].forEach(function(e){t.classList.remove(e)});t.classList.add("month-".concat(i._nbCols))}})},300)}},{key:"_refreshRange",value:function e(){var n=this;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")});if(this._mouseDown){var a=this._rangeStart<this._rangeEnd?this._rangeStart:this._rangeEnd;var r=this._rangeEnd>this._rangeStart?this._rangeEnd:this._rangeStart;this.element.querySelectorAll(".month-container").forEach(function(e){var t=parseInt(e.dataset.monthId);if(a.getMonth()<=t&&r.getMonth()>=t){e.querySelectorAll("td.day:not(.old):not(.new)").forEach(function(e){var t=n._getDate(e);if(t>=a&&t<=r){e.classList.add("range");if(t.getTime()==a.getTime()){e.classList.add("range-start")}if(t.getTime()==r.getTime()){e.classList.add("range-end")}}})}})}}},{key:"_getElementPosition",value:function e(t){var n=0,a=0;do{n+=t.offsetTop||0;a+=t.offsetLeft||0;t=t.offsetParent}while(t);return{top:n,left:a}}},{key:"_openContextMenu",value:function e(t){var n=this;var a=document.querySelector(".calendar-context-menu");if(a!==null){a.style.display="none";while(a.firstChild){a.removeChild(a.firstChild)}}else{a=document.createElement("div");a.classList.add("calendar-context-menu");document.body.appendChild(a)}var r=this._getDate(t);var i=this.getEvents(r);for(var o=0;o<i.length;o++){var s=document.createElement("div");s.classList.add("item");s.style.paddingLeft="4px";s.style.boxShadow="inset 4px 0 0 0 ".concat(i[o].color);var l=document.createElement("div");l.classList.add("content");var d=document.createElement("span");d.classList.add("text");d.textContent=i[o].name;l.appendChild(d);var c=document.createElement("span");c.classList.add("arrow");c.innerHTML="›";l.appendChild(c);s.appendChild(l);this._renderContextMenuItems(s,this.options.contextMenuItems,i[o]);a.appendChild(s)}if(a.children.length>0){var u=this._getElementPosition(t);a.style.left=u.left+25+"px";a.style.right="";a.style.top=u.top+25+"px";a.style.display="block";if(a.getBoundingClientRect().right>document.body.offsetWidth){a.style.left="";a.style.right="0"}setTimeout(function(){return n._checkContextMenuItemsPosition()},0);var h=function e(t){if(t.type!=="click"||!a.contains(t.target)){a.style.display="none";window.removeEventListener("click",e);window.removeEventListener("resize",e);window.removeEventListener("scroll",e)}};window.addEventListener("click",h);window.addEventListener("resize",h);window.addEventListener("scroll",h)}}},{key:"_renderContextMenuItems",value:function e(t,n,a){var r=document.createElement("div");r.classList.add("submenu");for(var i=0;i<n.length;i++){if(n[i].visible===false||typeof n[i].visible==="function"&&!n[i].visible(a)){continue}var o=document.createElement("div");o.classList.add("item");var s=document.createElement("div");s.classList.add("content");var l=document.createElement("span");l.classList.add("text");l.textContent=n[i].text;s.appendChild(l);if(n[i].click){(function(e){s.addEventListener("click",function(){document.querySelector(".calendar-context-menu").style.display="none";n[e].click(a)})})(i)}o.appendChild(s);if(n[i].items&&n[i].items.length>0){var d=document.createElement("span");d.classList.add("arrow");d.innerHTML="›";s.appendChild(d);this._renderContextMenuItems(o,n[i].items,a)}r.appendChild(o)}if(r.children.length>0){t.appendChild(r)}}},{key:"_checkContextMenuItemsPosition",value:function e(){var t=document.querySelectorAll(".calendar-context-menu .submenu");t.forEach(function(e){var t=e;t.style.display="block";t.style.visibility="hidden"});t.forEach(function(e){var t=e;if(t.getBoundingClientRect().right>document.body.offsetWidth){t.classList.add("open-left")}else{t.classList.remove("open-left")}});t.forEach(function(e){var t=e;t.style.display="";t.style.visibility=""})}},{key:"_getDate",value:function e(t){var n=t.querySelector(".day-content").textContent;var a=t.closest(".month-container").dataset.monthId;var r=this.options.startYear;return new Date(r,a,n)}},{key:"_triggerEvent",value:function e(t,n){var a=null;if(typeof Event==="function"){a=new Event(t)}else{a=document.createEvent("Event");a.initEvent(t,false,false)}a.calendar=this;for(var r in n){a[r]=n[r]}this.element.dispatchEvent(a);return a}},{key:"_isDisabled",value:function e(t){if(this.options.minDate!=null&&t<this.options.minDate||this.options.maxDate!=null&&t>this.options.maxDate){return true}if(this.options.disabledWeekDays.length>0){for(var n=0;n<this.options.disabledWeekDays.length;n++){if(t.getDay()==this.options.disabledWeekDays[n]){return true}}}if(this.options.disabledDays.length>0){for(var n=0;n<this.options.disabledDays.length;n++){if(t.getTime()==this.options.disabledDays[n].getTime()){return true}}}return false}},{key:"_isHidden",value:function e(t){if(this.options.hiddenWeekDays.length>0){for(var n=0;n<this.options.hiddenWeekDays.length;n++){if(t==this.options.hiddenWeekDays[n]){return true}}}return false}},{key:"getWeekNumber",value:function e(t){var n=new Date(t.getTime());n.setHours(0,0,0,0);n.setDate(n.getDate()+3-(n.getDay()+6)%7);var a=new Date(n.getFullYear(),0,4);return 1+Math.round(((n.getTime()-a.getTime())/864e5-3+(a.getDay()+6)%7)/7)}},{key:"getEvents",value:function e(t){return this.getEventsOnRange(t,new Date(t.getFullYear(),t.getMonth(),t.getDate()+1))}},{key:"getEventsOnRange",value:function e(t,n){var a=[];if(this._dataSource&&t&&n){for(var r=0;r<this._dataSource.length;r++){if(this._dataSource[r].startDate<n&&this._dataSource[r].endDate>=t){a.push(this._dataSource[r])}}}return a}},{key:"isThereFreeSlot",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=this.getEvents(t);if(a===true){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.endHalfDay||e.endDate>t})}else if(a===false){return!r.some(function(e){return!n.options.alwaysHalfDay&&!e.startHalfDay||e.startDate<t})}else{return this.isThereFreeSlot(t,false)||this.isThereFreeSlot(t,true)}}},{key:"getYear",value:function e(){return this.options.startYear}},{key:"setYear",value:function e(t){var n=this;var a=parseInt(t);if(!isNaN(a)){this.options.startYear=a;while(this.element.firstChild){this.element.removeChild(this.element.firstChild)}if(this.options.displayHeader){this._renderHeader()}var r=this._triggerEvent("yearChanged",{currentYear:this.options.startYear,preventRendering:false});if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{if(!r.preventRendering){this.render()}}}}},{key:"getMinDate",value:function e(){return this.options.minDate}},{key:"setMinDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.minDate=t;if(!n){this.render()}}}},{key:"getMaxDate",value:function e(){return this.options.maxDate}},{key:"setMaxDate",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t instanceof Date||t===null){this.options.maxDate=t;if(!n){this.render()}}}},{key:"getStyle",value:function e(){return this.options.style}},{key:"setStyle",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.style=t=="background"||t=="border"||t=="custom"?t:"border";if(!n){this.render()}}},{key:"getAllowOverlap",value:function e(){return this.options.allowOverlap}},{key:"setAllowOverlap",value:function e(t){this.options.allowOverlap=t}},{key:"getDisplayWeekNumber",value:function e(){return this.options.displayWeekNumber}},{key:"setDisplayWeekNumber",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayWeekNumber=t;if(!n){this.render()}}},{key:"getDisplayHeader",value:function e(){return this.options.displayHeader}},{key:"setDisplayHeader",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayHeader=t;if(!n){this.render()}}},{key:"getDisplayDisabledDataSource",value:function e(){return this.options.displayDisabledDataSource}},{key:"setDisplayDisabledDataSource",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.displayDisabledDataSource=t;if(!n){this.render()}}},{key:"getAlwaysHalfDay",value:function e(){return this.options.alwaysHalfDay}},{key:"setAlwaysHalfDay",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.alwaysHalfDay=t;if(!n){this.render()}}},{key:"getEnableRangeSelection",value:function e(){return this.options.enableRangeSelection}},{key:"setEnableRangeSelection",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableRangeSelection=t;if(!n){this.render()}}},{key:"getDisabledDays",value:function e(){return this.options.disabledDays}},{key:"setDisabledDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getDisabledWeekDays",value:function e(){return this.options.disabledWeekDays}},{key:"setDisabledWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.disabledWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getHiddenWeekDays",value:function e(){return this.options.hiddenWeekDays}},{key:"setHiddenWeekDays",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.hiddenWeekDays=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getRoundRangeLimits",value:function e(){return this.options.roundRangeLimits}},{key:"setRoundRangeLimits",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.roundRangeLimits=t;if(!n){this.render()}}},{key:"getEnableContextMenu",value:function e(){return this.options.enableContextMenu}},{key:"setEnableContextMenu",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.enableContextMenu=t;if(!n){this.render()}}},{key:"getContextMenuItems",value:function e(){return this.options.contextMenuItems}},{key:"setContextMenuItems",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.contextMenuItems=t instanceof Array?t:[];if(!n){this.render()}}},{key:"getCustomDayRenderer",value:function e(){return this.options.customDayRenderer}},{key:"setCustomDayRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDayRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getCustomDataSourceRenderer",value:function e(){return this.options.customDataSourceRenderer}},{key:"setCustomDataSourceRenderer",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.customDataSourceRenderer=typeof t==="function"?t:null;if(!n){this.render()}}},{key:"getLanguage",value:function e(){return this.options.language}},{key:"setLanguage",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t!=null&&D.locales[t]!=null){this.options.language=t;if(!n){this.render()}}}},{key:"getDataSource",value:function e(){return this.options.dataSource}},{key:"setDataSource",value:function e(t){var n=this;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.dataSource=t instanceof Array||typeof t==="function"?t:[];if(typeof this.options.dataSource==="function"){this.render(true);this._fetchDataSource(function(e){n._dataSource=e;n._initializeDatasourceColors();n.render(false)})}else{this._dataSource=this.options.dataSource;this._initializeDatasourceColors();if(!a){this.render()}}}},{key:"getWeekStart",value:function e(){return this.options.weekStart?this.options.weekStart:D.locales[this.options.language].weekStart}},{key:"setWeekStart",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this.options.weekStart=!isNaN(parseInt(t))?parseInt(t):null;if(!n){this.render()}}},{key:"getLoadingTemplate",value:function e(){return this.options.loadingTemplate}},{key:"setLoadingTemplate",value:function e(t){this.options.loadingTemplate=typeof t==="string"||t instanceof HTMLElement?t:null}},{key:"addEvent",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;this._dataSource.push(t);if(!n){this.render()}}}]);return D}();if(i(e["default"]=s,"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}}),i(s,"colors",["#2C8FC9","#9CB703","#F5BB00","#FF4A32","#B56CE2","#45A597"]),(typeof window==="undefined"?"undefined":t(window))==="object"){window.Calendar=s;document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll('[data-provide="calendar"]').forEach(function(e){return new s(e)})})}}(e)}((n={exports:{}},n.exports)),n.exports),h=(a=u)&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}('/* =========================================================\n * JS year calendar v0.1.0\n * Repo: https://github.com/year-calendar/js-year-calendar\n * =========================================================\n * Created by Paul David-Sivelle\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ========================================================= */\n/* Main */\n.calendar {\n padding: 4px;\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n direction: ltr;\n overflow-x: hidden;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n /* Header */\n /* Months */\n /* Loading */\n}\n.calendar:after {\n /* Apply the right height on the calendar div, even if the months elements are floating */\n clear: both;\n content: "";\n display: block;\n}\n.calendar .calendar-rtl {\n direction: rtl;\n}\n.calendar .calendar-rtl .calendar-rtl table tr td span {\n float: right;\n}\n.calendar table {\n margin: auto;\n border-spacing: 0;\n}\n.calendar table td,\n.calendar table th {\n text-align: center;\n width: 20px;\n height: 20px;\n border: none;\n padding: 4px 5px;\n font-size: 12px;\n}\n.calendar .calendar-header {\n width: 100%;\n margin-bottom: 20px;\n border: 1px solid #ddd;\n}\n.calendar .calendar-header table {\n width: 100%;\n}\n.calendar .calendar-header table th {\n font-size: 22px;\n padding: 5px 10px;\n cursor: pointer;\n}\n.calendar .calendar-header table th:hover {\n background: #eeeeee;\n}\n.calendar .calendar-header table th.disabled,\n.calendar .calendar-header table th.disabled:hover {\n background: none;\n cursor: default;\n color: white;\n}\n.calendar .calendar-header table th.prev,\n.calendar .calendar-header table th.next {\n width: 20px;\n}\n.calendar .calendar-header .year-title {\n font-weight: bold;\n text-align: center;\n height: 20px;\n width: auto;\n}\n.calendar .calendar-header .year-neighbor {\n opacity: 0.4;\n}\n@media (max-width: 991px) {\n .calendar .calendar-header .year-neighbor {\n display: none;\n }\n}\n.calendar .calendar-header .year-neighbor2 {\n opacity: 0.2;\n}\n@media (max-width: 767px) {\n .calendar .calendar-header .year-neighbor2 {\n display: none;\n }\n}\n.calendar .months-container {\n width: 100%;\n display: none;\n}\n.calendar .months-container .month-container {\n float: left;\n text-align: center;\n height: 200px;\n padding: 0;\n}\n.calendar .months-container .month-container.month-2 {\n width: 16.66666667%;\n}\n.calendar .months-container .month-container.month-3 {\n width: 25%;\n}\n.calendar .months-container .month-container.month-4 {\n width: 33.33333333%;\n}\n.calendar .months-container .month-container.month-6 {\n width: 50%;\n}\n.calendar .months-container .month-container.month-12 {\n width: 100%;\n}\n.calendar table.month th.month-title {\n font-size: 16px;\n padding-bottom: 5px;\n}\n.calendar table.month th.day-header {\n font-size: 14px;\n}\n.calendar table.month tr td,\n.calendar table.month tr th {\n padding: 0;\n}\n.calendar table.month tr td.hidden,\n.calendar table.month tr th.hidden {\n display: none;\n}\n.calendar table.month td.week-number {\n cursor: default;\n font-weight: bold;\n border-right: 1px solid #eee;\n padding: 5px;\n}\n.calendar table.month td.day.round-left {\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n border-radius: 8px 0 0 8px;\n}\n.calendar table.month td.day.round-right {\n webkit-border-radius: 0 8px 8px 0 ;\n -moz-border-radius: 0 8px 8px 0;\n border-radius: 0 8px 8px 0;\n}\n.calendar table.month td.day .day-content {\n -webkit-border-radius: 4px;\n -moz-border-radius: 4px;\n border-radius: 4px;\n padding: 5px 6px;\n}\n.calendar table.month td.old,\n.calendar table.month td.new,\n.calendar table.month td.old:hover,\n.calendar table.month td.new:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.disabled,\n.calendar table.month td.disabled:hover {\n color: #dddddd;\n}\n.calendar table.month td.disabled .day-content:hover,\n.calendar table.month td.disabled:hover .day-content:hover {\n background: none;\n cursor: default;\n}\n.calendar table.month td.range .day-content {\n background: rgba(0, 0, 0, 0.2);\n -webkit-border-radius: 0;\n -moz-border-radius: 0;\n border-radius: 0;\n}\n.calendar table.month td.range.range-start .day-content {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.calendar table.month td.range.range-end .day-content {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.calendar .calendar-loading-container {\n position: relative;\n text-align: center;\n min-height: 200px;\n}\n.calendar .calendar-loading-container .calendar-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translateX(-50%) translateY(-50%);\n}\n.calendar .calendar-spinner {\n margin: 20px auto;\n width: 80px;\n text-align: center;\n}\n.calendar .calendar-spinner > div {\n width: 16px;\n height: 16px;\n margin: 5px;\n background-color: #333;\n border-radius: 100%;\n display: inline-block;\n -webkit-animation: sk-bouncedelay 1s infinite ease-in-out both;\n animation: sk-bouncedelay 1s infinite ease-in-out both;\n}\n.calendar .calendar-spinner > div.bounce1 {\n -webkit-animation-delay: -0.32s;\n animation-delay: -0.32s;\n}\n.calendar .calendar-spinner > div.bounce2 {\n -webkit-animation-delay: -0.16s;\n animation-delay: -0.16s;\n}\n/* Context menu */\n.calendar-context-menu,\n.calendar-context-menu .submenu {\n border: 1px solid #ddd;\n background-color: white;\n box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);\n position: absolute;\n display: none;\n}\n.calendar-context-menu .item {\n position: relative;\n}\n.calendar-context-menu .item .content {\n padding: 5px 10px;\n cursor: pointer;\n display: table;\n width: 100%;\n white-space: nowrap;\n}\n.calendar-context-menu .item .content:hover {\n background: #eee;\n}\n.calendar-context-menu .item .content .text {\n display: table-cell;\n}\n.calendar-context-menu .item .content .arrow {\n display: table-cell;\n padding-left: 10px;\n text-align: right;\n}\n.calendar-context-menu .item .submenu {\n top: -1px;\n /* Compensate for the border */\n}\n.calendar-context-menu .item .submenu:not(.open-left) {\n left: 100%;\n}\n.calendar-context-menu .item .submenu.open-left {\n right: 100%;\n}\n.calendar-context-menu .item:hover > .submenu {\n display: block;\n}\n.table-striped .calendar table.month tr td,\n.table-striped .calendar table.month tr th {\n background-color: transparent;\n}\ntable.month td.day .day-content:hover {\n background: rgba(0, 0, 0, 0.2);\n cursor: pointer;\n}\n@-webkit-keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n }\n}\n@keyframes sk-bouncedelay {\n 0%,\n 80%,\n 100% {\n -webkit-transform: scale(0);\n transform: scale(0);\n }\n 40% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n}\n');var p=function(){!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)}(r,i.Component);var e,t,n,a=c(r);function r(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),a.call(this,e)}return e=r,(t=[{key:"componentDidMount",value:function(){this.JsCalendar=new h(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:"compare",value:function(t,n){var a=this;if("function"==typeof t&&"function"==typeof n)return t.toString()!=n.toString();if(t instanceof Date&&n instanceof Date)return t.getTime()!=n.getTime();if(null===t||"object"!==o(t)||null===n||"object"!==o(n))return t!=n;var e=Object.keys(t),r=Object.keys(n);return e.length!==r.length||e.some(function(e){return a.compare(t[e],n[e])})}},{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=[];this.compare(e.allowOverlap,this.props.allowOverlap)&&n.push(function(){return t.setAllowOverlap(e.allowOverlap)}),this.compare(e.alwaysHalfDay,this.props.alwaysHalfDay)&&n.push(function(){return t.setAlwaysHalfDay(e.alwaysHalfDay,!0)}),this.compare(e.contextMenuItems,this.props.contextMenuItems)&&n.push(function(){return t.setContextMenuItems(e.contextMenuItems,!0)}),this.compare(e.customDayRenderer,this.props.customDayRenderer)&&n.push(function(){return t.setCustomDayRenderer(e.customDayRenderer,!0)}),this.compare(e.customDataSourceRenderer,this.props.customDataSourceRenderer)&&n.push(function(){return t.setCustomDataSourceRenderer(e.customDataSourceRenderer,!0)}),this.compare(e.dataSource,this.props.dataSource)&&n.push(function(){return t.setDataSource(e.dataSource,!0)}),this.compare(e.disabledDays,this.props.disabledDays)&&n.push(function(){return t.setDisabledDays(e.disabledDays,!0)}),this.compare(e.disabledWeekDays,this.props.disabledWeekDays)&&n.push(function(){return t.setDisabledWeekDays(e.disabledWeekDays,!0)}),this.compare(e.displayDisabledDataSource,this.props.displayDisabledDataSource)&&n.push(function(){return t.setDisplayDisabledDataSource(e.displayDisabledDataSource,!0)}),this.compare(e.displayHeader,this.props.displayHeader)&&n.push(function(){return t.setDisplayHeader(e.displayHeader,!0)}),this.compare(e.displayWeekNumber,this.props.displayWeekNumber)&&n.push(function(){return t.setDisplayWeekNumber(e.displayWeekNumber,!0)}),this.compare(e.enableContextMenu,this.props.enableContextMenu)&&n.push(function(){return t.setEnableContextMenu(e.enableContextMenu,!0)}),this.compare(e.enableRangeSelection,this.props.enableRangeSelection)&&n.push(function(){return t.setEnableRangeSelection(e.enableRangeSelection,!0)}),this.compare(e.hiddenWeekDays,this.props.hiddenWeekDays)&&n.push(function(){return t.setHiddenWeekDays(e.hiddenWeekDays,!0)}),this.compare(e.language,this.props.language)&&n.push(function(){return t.setLanguage(e.language,!0)}),this.compare(e.loadingTemplate,this.props.loadingTemplate)&&n.push(function(){return t.setLoadingTemplate(e.loadingTemplate,!0)}),this.compare(e.maxDate,this.props.maxDate)&&n.push(function(){return t.setMaxDate(e.maxDate,!0)}),this.compare(e.minDate,this.props.minDate)&&n.push(function(){return t.setMinDate(e.minDate,!0)}),this.compare(e.roundRangeLimits,this.props.roundRangeLimits)&&n.push(function(){return t.setRoundRangeLimits(e.roundRangeLimits,!0)}),this.compare(e.style,this.props.style)&&n.push(function(){return t.setStyle(e.style,!0)}),this.compare(e.weekStart,this.props.weekStart)&&n.push(function(){return t.setWeekStart(e.weekStart,!0)}),this.compare(e.year,this.props.year)&&n.push(function(){return t.setYear(e.year)}),this.compare(e.onDayClick,this.props.onDayClick)&&this.updateEvent("clickDay",this.props.onDayClick,e.onDayClick),this.compare(e.onDayContextMenu,this.props.onDayContextMenu)&&this.updateEvent("dayContextMenu",this.props.onDayContextMenu,e.onDayContextMenu),this.compare(e.onDayEnter,this.props.onDayEnter)&&this.updateEvent("mouseOnDay",this.props.onDayEnter,e.onDayEnter),this.compare(e.onDayLeave,this.props.onDayLeave)&&this.updateEvent("mouseOutDay",this.props.onDayLeave,e.onDayLeave),this.compare(e.onRenderEnd,this.props.onRenderEnd)&&this.updateEvent("renderEnd",this.props.onRenderEnd,e.onRenderEnd),this.compare(e.onRangeSelected,this.props.onRangeSelected)&&this.updateEvent("selectRange",this.props.onRangeSelected,e.onRangeSelected),this.compare(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}})}}])&&s(e.prototype,t),n&&s(e,n),r}();return t(p,"propsTypes",{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}),t(p,"locales",h.locales),p},"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.1", | ||
"version": "1.0.2", | ||
"description": "Official react wrapper for the year-calendar widget", | ||
@@ -36,3 +36,3 @@ "main": "./dist/rc-year-calendar.js", | ||
"dependencies": { | ||
"js-year-calendar": "^1.0.1" | ||
"js-year-calendar": "^1.0.2" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependencies": { |
@@ -107,3 +107,3 @@ import React from "react"; | ||
var aKeys = Object.keys(a); | ||
var bKeys = Object.keys(a); | ||
var bKeys = Object.keys(b); | ||
@@ -179,2 +179,2 @@ if (aKeys.length !== bKeys.length) { | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
5169
342212
39
Updatedjs-year-calendar@^1.0.2