You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
28 KiB

!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={};t(n),e.jsYearCalendar=n}}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}if(Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,"undefined"==typeof NodeList||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)}),"undefined"!=typeof Element&&!Element.prototype.matches){var n=Element.prototype;Element.prototype.matches=n.msMatchesSelector||n.webkitMatchesSelector}"undefined"==typeof Element||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(null!==t&&1==t.nodeType);return null});var s=function(){function D(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,D),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),e instanceof HTMLElement)this.element=e;else{if("string"!=typeof e)throw new Error("The element parameter should be a DOM node or a selector");this.element=document.querySelector(e)}this.element.classList.add("calendar"),this._initializeEvents(t),this._initializeOptions(t),this.setYear(this.options.startYear)}var e,t,n;return e=D,(t=[{key:"_initializeOptions",value:function(e){null==e&&(e={}),this.options={startYear:isNaN(parseInt(e.startYear))?(new Date).getFullYear():parseInt(e.startYear),minDate:e.minDate instanceof Date?e.minDate:null,maxDate:e.maxDate instanceof Date?e.maxDate:null,language:null!=e.language&&null!=D.locales[e.language]?e.language:"en",allowOverlap:null==e.allowOverlap||e.allowOverlap,displayWeekNumber:null!=e.displayWeekNumber&&e.displayWeekNumber,displayDisabledDataSource:null!=e.displayDisabledDataSource&&e.displayDisabledDataSource,displayHeader:null==e.displayHeader||e.displayHeader,alwaysHalfDay:null!=e.alwaysHalfDay&&e.alwaysHalfDay,enableRangeSelection:null!=e.enableRangeSelection&&e.enableRangeSelection,disabledDays:e.disabledDays instanceof Array?e.disabledDays:[],disabledWeekDays:e.disabledWeekDays instanceof Array?e.disabledWeekDays:[],hiddenWeekDays:e.hiddenWeekDays instanceof Array?e.hiddenWeekDays:[],roundRangeLimits:null!=e.roundRangeLimits&&e.roundRangeLimits,dataSource:e.dataSource instanceof Array||"function"==typeof e.dataSource?e.dataSource:[],style:"background"==e.style||"border"==e.style||"custom"==e.style?e.style:"border",enableContextMenu:null!=e.enableContextMenu&&e.enableContextMenu,contextMenuItems:e.contextMenuItems instanceof Array?e.contextMenuItems:[],customDayRenderer:"function"==typeof e.customDayRenderer?e.customDayRenderer:null,customDataSourceRenderer:"function"==typeof e.customDataSourceRenderer?e.customDataSourceRenderer:null,weekStart:isNaN(parseInt(e.weekStart))?null:parseInt(e.weekStart),loadingTemplate:"string"==typeof e.loadingTemplate||e.loadingTemplate instanceof HTMLElement?e.loadingTemplate:null},this.options.dataSource instanceof Array&&(this._dataSource=this.options.dataSource,this._initializeDataso