UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

7 lines 26.4 kB
/* @license */ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`kendo.core.min.js`),require(`kendo.selectable.min.js`),require(`kendo.calendar.min.js`),require(`kendo.icons.min.js`)):typeof define==`function`&&define.amd?define([`exports`,`kendo.core.min`,`kendo.selectable.min`,`kendo.calendar.min`,`kendo.icons.min`],t):(e=typeof globalThis<`u`?globalThis:e||self,t((e.kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Multiviewcalendar={}),e.kendo._globals.Core,e.kendo._globals.Selectable,e.kendo._globals.Calendar,e.kendo._globals.Icons))})(this,function(e,t,n,r,i){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let a={id:`multiviewcalendar`,name:`MultiViewCalendar`,category:`web`,description:`Multi-view calendar.`,depends:[`core`,`selectable`,`calendar`]};(function(e,t){let n=window.kendo,r=n.calendar,i=n.support,a=r.isInRange,o=r.toDateObject,s=r.createDate,c=r.isEqualDate,l=r.getToday,u=n.keys,d=n.ui,f=d.Widget,p=d.Selectable,m=d.RangeSelectable,h=n.template,g=i.mobileOS,_=`.kendoMultiViewCalendar`,v=`click`,y=`month`,b=`century`,x=`change`,S=`navigate`,C=`value`,w=`k-focus`,T=`k-selected`,E=`k-hover`,D=`k-disabled`,O=`k-calendar-nav-today`,k=`k-empty`,A=`k-calendar-view`,j=`td:has(.k-link):not(.`+k+`):not(.k-alt)`,M=`td:has(.k-link):not(.`+D+`):not(.k-empty):not(.k-alt)`,N=`focus`,P=i.touch?`touchstart`:`mouseenter`,F=i.touch?`touchend`+_+` touchmove.kendoMultiViewCalendar`:`mouseleave`+_,I=`_prevArrow`,L=`_nextArrow`,R=`start`,z=`table`,B=`tbody`,V=`thead`,H=`td:not(.k-alt)`,U=`role`,W=`none`,G=`aria-disabled`,K=`aria-label`,q=`aria-activedescendant`,J=Date,Y={month:0,year:1,decade:2,century:3};var X=f.extend({init:function(t,i){var a=this,o,s;f.fn.init.call(a,t,i),t=a.wrapper=a.element,i=a.options,a.options.disableDates=r.disabled(a.options.disableDates),s=n.getCulture(i.culture),i.format=n._extractFormat(i.format||s.calendars.standard.patterns.d),a._templates(),a._header(),a._wrapper(),o=t.addClass(`k-calendar k-calendar-range ${n.getValidCssClass(`k-calendar-`,`size`,a.options.size)}`+(i.weekNumber?` k-week-number`:``)).on(`keydown`+_,`.`+A,a._move.bind(a)).on(N+_,`.`+A,a._focus.bind(a)).on(`blur`+_,`.`+A,a._blur.bind(a)).on(v+_,M,function(t){var n=t.currentTarget.firstChild;e(n).data(`href`).indexOf(`#`)!=-1&&t.preventDefault(),a._click(e(n))}).attr(`id`),o||=n.guid(),a._cellID=o+`_cell_selected`,a._calendarWidth=a.element.width(),a._range=i.range,a._range&&a._range.start&&!a._range.end&&(a._range.target=`end`),a._initViews({viewName:i.start,value:i.value}),a._selectable(),a._footer(a.footer),a._selectDates=[],a.value(i.value),a._addSelectedCellsToArray(),a._isMultipleSelection()&&(a._selectDates=i.selectDates.length?i.selectDates:a._selectDates,a._restoreSelection()),a._isRangeSelection()&&a.selectRange(a._range),n.notify(a)},options:{name:`MultiViewCalendar`,value:null,min:new J(1900,0,1),max:new J(2099,11,31),dates:[],allowReverse:!1,disableDates:null,showOtherMonthDays:!1,centuryCellsFormat:`long`,culture:``,footer:``,format:``,month:{},range:{start:null,end:null,target:R},weekNumber:!1,views:2,showViewHeader:!1,selectable:`single`,selectDates:[],start:y,depth:y,messages:{weekColumnHeader:``},size:t,orientation:`horizontal`},events:[x,S],setOptions:function(e){var t=this;r.normalize(e),e.disableDates=r.disabled(e.disableDates),f.fn.setOptions.call(t,e),t._selectable(),t._templates(),t._footer(t.footer);for(var n=0;n<t._views.length;n++)t._views[n].off(_).remove();t._initViews({viewName:e.start,value:e.value}),t._range=e.range||{start:null,end:null},t._restoreSelection(),t._isRangeSelection()&&t.selectRange(t._range)},destroy:function(){var e=this;if(e._cell=null,e._currentView=null,e._current=null,e._views)for(var t=0;t<e._views.length;t++)e._views[t].off(_).remove();e.element.off(_),e.header&&=(e.header.off(_),e._title=null,null),e.selectable&&=(e.selectable.destroy(),null),e.rangeSelectable&&=(e.rangeSelectable.destroy(),null),e._today&&n.destroy(e._today.off(_)),e._views=null,f.fn.destroy.call(e)},current:function(){return this._current},focus:function(){this.tablesWrapper.trigger(`focus`)},min:function(e){return this._option(`min`,e)},max:function(e){return this._option(`max`,e)},view:function(){return this._currentView},navigateToPast:function(){this._navigate(I,-1)},navigateToFuture:function(){this._navigate(L,1)},navigateUp:function(){var e=this,t=e._index;e._title.hasClass(D)||e.navigate(e._current,++t)},navigateDown:function(e){var t=this,n=t._index,r=t.options.depth;if(e){if(n===Y[r]){(!c(t._value,t._current)||!c(t._value,e))&&(t.value(e),t.trigger(x));return}t.navigate(e,--n)}},navigate:function(e,n){n=isNaN(n)?r.views[r.viewsEnum[n]]:r.views[n];var i=this,a=i.options,o=a.min,s=a.max;e?i._current=e:i._current=e=new J(+r.restrictValue(e,o,s)),n===t&&(n=i._currentView),i._currentView=n;for(var c=0;c<i._views.length;c++)i._views[c].off(_).remove();i._initViews({viewName:n.name,value:e}),i._restoreSelection()},_aria:function(){var e=this.tablesWrapper.find(z),t=e.first().find(V).add(e.find(B)),n=this._currentView.name;e.removeAttr(`tabindex`),e.attr({role:W}),t.attr({role:`rowgroup`}),n===y&&this._ariaMonth()},_ariaMonth:function(){var t=this.tablesWrapper.find(z),n=t.first().find(V).add(t.find(B)).find(`tr`),r=t.not(`:eq(0)`).find(V+` tr`),i=r.find(`th`),a=t.first().find(V+` th`),o=t.find(B+` td.k-alt`),s=t.find(`.`+k);a.attr({role:`columnheader`}),o.attr({role:`rowheader`}),s.removeAttr(U),r.removeAttr(U),i.removeAttr(K).removeAttr(U),n.each(function(t,r){var i=e(r),a=i.find(`.`+k).length,o=[],s,c;t===1?i.children().filter(`.`+k).attr({"aria-hidden":`false`,role:`gridcell`}):a===7?(i.removeAttr(U),i.find(`th`).removeAttr(U)):a>0&&a<7&&i.children().not(`th`).first().hasClass(k)&&(i.find(`th`).removeAttr(U),s=n.eq(t-1),(!s.attr(U)||s.attr(U)===W)&&(s=n.eq(t-2)),c=i.children().not(`th`),c.each(function(n,r){var i=e(r),a;i.hasClass(k)||(a=`owned_`+t+`_`+n,i.attr(`id`,a),o.push(a))}),i.removeAttr(U),s.attr(`aria-owns`,o.join(` `)))})},_updateHeader:function(){let t=this,r=t._currentView,i=t._title,o=t._firstViewValue,s=t.options,c=t._visibleRange(),l=s.culture,u=s.min,d=s.max,f,p,m,h;r.name===`decade`||r.name===b?(f=$(o,r.name,s.views-1),a(f,u,d)||(f=d),i.html(`<span class="k-button-text">`+r.first(o).getFullYear()+` - `+r.last(f).getFullYear()+`</span>`)):i.html(`<span class="k-button-text">`+r.title(o,u,d,l)+` - `+r.title($(o,r.name,s.views-1),u,d,l)+`</span>`),p=r.name===b,i.toggleClass(D,p).attr(G,p),m=r.compare(c.start,t.options.min)<1,h=r.compare(c.end,t.options.max)>-1,m&&h?t._navContainer&&=(t._navContainer.remove(),null):(t._navContainer||(t._navContainer=e(`<span class="k-calendar-nav"><span tabindex="-1" data-href="#" role="button" class="k-button ${n.getValidCssClass(`k-button-`,`size`,t.options.size)} k-button-flat k-icon-button k-calendar-nav-prev" aria-label="Previous">${n.ui.icon({icon:`chevron-left`,iconClass:`k-button-icon`})}</span><span tabindex="-1" data-href="#" role="button" class="k-button ${n.getValidCssClass(`k-button-`,`size`,t.options.size)} k-button-flat k-icon-button k-calendar-nav-next" aria-label="Next">${n.ui.icon({icon:`chevron-right`,iconClass:`k-button-icon`})}</span></span>`).appendTo(t.header),t[I]=t._navContainer.find(`.k-calendar-nav-prev`),t[L]=t._navContainer.find(`.k-calendar-nav-next`)),t[I].toggleClass(D,m).attr(G,m),t[I].hasClass(D)&&t[I].removeClass(E),t[L].toggleClass(D,h).attr(G,h),t[L].hasClass(D)&&t[L].removeClass(E))},_move:function(r){var i=this,c=i.options,l=r.keyCode,d=i._index,f=c.min,p=c.max,m=i.element.find(`.`+w),h=m.closest(z),g=new J(+(i._current||o(m.find(`span`)))),_=n.support.isRtl(i.wrapper),v=!1,b,C,E,O,k,A,j;if(l==u.RIGHT&&!_||l==u.LEFT&&_?(b=1,C=!0):l==u.LEFT&&!_||l==u.RIGHT&&_?(b=-1,C=!0):l==u.UP?(b=d===0?-7:-4,C=!0):l==u.DOWN?(b=d===0?7:4,C=!0):l==u.SPACEBAR?(b=0,C=!0):l==u.HOME?(C=!0,O=h.find(M).eq(0),O.hasClass(w)?(h=h.prev(),h.length?i._focusCell(h.find(M).eq(0)):(v=i[I]&&!i[I].hasClass(D),i._navigate(I,-1),i._focusCell(i.element.find(z).first().find(M).first()))):i._focusCell(O)):l==u.END?(C=!0,O=h.find(M).last(),O.hasClass(w)?(h=h.next(),h.length?i._focusCell(h.find(M).last()):(v=i[L]&&!i[L].hasClass(D),i._navigate(L,1),i._focusCell(i.element.find(z).last().find(M).last()))):i._focusCell(O)):l===84&&(i._todayClick(r),C=!0),r.ctrlKey||r.metaKey)l==u.RIGHT&&!_||l==u.LEFT&&_?(v=i[L]&&!i[L].hasClass(D),i._navigate(L,1),C=!0):l==u.LEFT&&!_||l==u.RIGHT&&_?(v=i[I]&&!i[I].hasClass(D),i._navigate(I,-1),C=!0):l==u.UP?(v=!i._title.hasClass(D),i.navigateUp(),i._focusCell(i._cellByDate(i._current)),C=!0):l==u.DOWN?(i._currentView.name===y?i.value(g):(i.navigateDown(g),i._focusCell(i._cellByDate(i._current)),v=!0),C=!0):(l==u.ENTER||l==u.SPACEBAR)&&i._isMultipleSelection()&&i._toggleSelection(r);else if(r.shiftKey&&!i._isSingleSelection()){if(b!==t||E){if(E||i._currentView.setDate(g,b),i._currentView.name!==y)return;c.disableDates(g)&&(g=i._nextNavigatable(g,b)),f=s(f.getFullYear(),f.getMonth(),f.getDate()),a(g,f,p)&&(i._dateInViews(g)||(b>0?(v=i[L]&&!i[L].hasClass(D),i._navigate(L,1)):(v=i[I]&&!i[I].hasClass(D),i._navigate(I,-1))),O=i._cellByDate(g),i._current=g,i.selectable&&(i._selectRange(o((i.selectable._lastActive||m).find(`span`)),g),i.selectable._lastActive||(i.selectable._lastActive=m),i.trigger(x),i._focusCell(O)),i.rangeSelectable&&(k=o((i.rangeSelectable._lastActive||m).find(`span`)),i._dateInViews(k)?(i.rangeSelectable._end&&i.rangeSelectable._end.is(`.`+w)?i.rangeSelectable._lastActive=i.rangeSelectable._start:i.rangeSelectable._lastActive=i._cellByDate(k),i.rangeSelectable.range(i.rangeSelectable._lastActive,O)):+k>+g?(i.rangeSelectable._end=i.rangeSelectable._lastActive,i.rangeSelectable.selectFrom(O)):i.rangeSelectable.selectTo(O),i.rangeSelectable.change(),i._focusCell(O)))}}else l==u.ENTER||l==u.SPACEBAR?(i._currentView.name===y?(j=!m.hasClass(T)||i.element.find(`.`+T).length>1,i.value(g),i.selectable&&(i.selectable._lastActive=i._cellByDate(g),j&&i.selectable.trigger(x,{event:r})),i.rangeSelectable&&i.rangeSelectable.change()):i._click(e(i._cell[0].firstChild)),C=!0):(l==u.PAGEUP||l==u.PAGEDOWN)&&(C=!0,A=h.find(M).index(m),h=l==u.PAGEUP?h.prev():h.next(),h.length||(l==u.PAGEUP?(v=i[I]&&!i[I].hasClass(D),i.navigateToPast(),h=i.element.find(z).first()):(v=i[L]&&!i[L].hasClass(D),i.navigateToFuture(),h=i.element.find(z).last())),O=h.find(M).eq(A),O.length?i._focusCell(O):i._focusCell(h.find(M).last())),(b||E)&&(E||i._currentView.setDate(g,b),f=s(f.getFullYear(),f.getMonth(),f.getDate()),a(g,f,p)&&(i.selectable&&c.disableDates(g)&&(g=i._nextNavigatable(g,b)),i._dateInViews(g)||(b>0?(v=i[L]&&!i[L].hasClass(D),i._navigate(L,1)):(v=i[I]&&!i[I].hasClass(D),i._navigate(L,-1))),O=i._cellByDate(g),i._current=g,i._focusCell(O)));return v&&i.trigger(S),C&&r.preventDefault(),i._current},_visualizeSelectedDatesInView:function(){var t=this,r={},i;e.each(t._selectDates,function(e,t){r[n.calendar.views[0].toDateString(t)]=t}),t.selectable.clear(),i=t.element.find(z).find(j).filter(function(t,i){return r[e(i.firstChild).attr(n.attr(C))]}),i.length>0&&t.selectable._selectElement(i,!0)},_nextNavigatable:function(e,t){var n=this,r=!0,i=n._currentView,o=n.options.min,s=n.options.max,c=n.options.disableDates,l=new Date(e.getTime());for(i.setDate(l,-t);r;){if(i.setDate(e,t),!a(e,o,s)){e=l;break}r=c(e)}return e},_toggleSelection:function(t){var n=this;n.selectable._lastActive=e(n._cell[0]),e(n._cell[0]).hasClass(T)?n.selectable._unselect(e(n._cell[0])):n.selectable.value(e(n._cell[0])),n.selectable.trigger(x,{event:t})},_option:function(e,r){var i=this,a=i.options,o=i._value||i._current,s;if(r===t)return a[e];r=n.parseDate(r,a.format,a.culture),r&&(a[e]=new J(+r),s=e===`min`?r>o:o>r,s&&(i._value=null),i.navigate(i._value),i._toggle())},_cellByDate:function(t){return t instanceof Date&&(t=this._currentView.toDateString(t)),this.element.find(z).find(`td:not(.k-other-month)`).filter(function(){return e(this.firstChild).attr(n.attr(C))===t})},_selectable:function(){let e=this,n=e.options.selectable,r=p.parseOptions(n);e.selectable&&=(e.selectable.destroy(),null),e.rangeSelectable&&=(e.rangeSelectable.destroy(),null),r.range?e.rangeSelectable=new m(e.wrapper,{widget:e,filter:`.k-calendar-monthview table `+M,cellSelector:j,cellSelectorValid:M,change:e._rangeSelection.bind(e),reverse:e.options.allowReverse,resetOnStart:n.resetOnStart===t?!0:n.resetOnStart,ns:_,inputSelectors:`input,a,span,textarea,.k-multiselect-wrap,select,button,.k-button>span,.k-button>img,span.k-icon.k-i-caret-alt-down,span.k-icon.k-i-caret-alt-up,span.k-svg-icon.k-svg-i-caret-alt-down,span.k-svg-icon.k-svg-i-caret-alt-up`}):e.selectable=new p(e.wrapper,{aria:!0,dragToSelect:!1,multiple:r.multiple,filter:`table.k-calendar-table `+M,selectableClass:`k-calendar`,change:e._selection.bind(e),relatedTarget:e._onRelatedTarget.bind(e),unselect:e._unselecting.bind(e)})},_onRelatedTarget:function(e){var t=this;t.selectable.options.multiple&&e.is(M)&&e.length>1&&t._focusCell(e.first(),!0)},_getFirstViewDate:function(e){var t=this,n=t.options,r=[],i,a,o=new Date(+t._current),s;for(s=0;s<n.views;s++){if(i=e.first(o),a=e.last(o),+a>+n.max){+i<=+n.max&&r.push({start:i,end:new Date(+n.max)});break}r.push({start:i,end:a}),o=new Date(+$(a,e.name,1))}for(o=new Date(+t._current),s=0;s<n.views;s++){if(i=e.first(o),a=e.last(o),+i<+n.min){+a>=+n.min&&r.push({start:new Date(+n.min),end:a});break}r.push({start:i,end:a}),o=new Date(+$(i,e.name,-1))}for(i=r[0].start,s=0;s<n.views+1&&r[s];s++)+i>+r[s].start&&(i=r[s].start);return new Date(+i)},_canRenderNextView:function(e){var t=e.getFullYear(),n=e.getMonth(),r=e.getDate(),i=this.options.max,a=i.getFullYear(),o=i.getMonth();return t<a||t===a&&n<o||t===a&&n===o&&r<i.getDate()||t===a&&n===o&&r===i.getDate()},_initViews:function(t){var n=this,i=n.options,a=r.viewsEnum[t.viewName],o=r.views[a],s;n._current=new J(+r.restrictValue(t.value,i.min,i.max)),n._views=[],n._index=a,s=n._getFirstViewDate(o),s.setDate(1),n._firstViewValue=new Date(+s);for(var c=0;c<i.views&&(s=c?$(s,o.name,1):s,s.setDate(1),n._canRenderNextView(s));c++)n._table=e(o.content(e.extend({min:i.min,max:i.max,date:s,url:i.url,dates:i.dates,format:i.format,culture:i.culture,disableDates:i.disableDates,showHeader:i.showViewHeader,isWeekColumnVisible:i.weekNumber,showOtherMonthDays:i.showOtherMonthDays,centuryCellsFormat:i.centuryCellsFormat,messages:i.messages,contentClasses:`k-calendar-table`},n[o.name]))),n._table.appendTo(n.tablesWrapper),n._views.push(n._table);n._currentView=o,n.tablesWrapper.attr(`class`,`k-calendar-view k-calendar-`+o.name+`view ${n.options.orientation==`vertical`?`k-vstack`:`k-hstack`} k-align-items-start k-justify-content-center`),n._updateHeader(),n._aria()},_rangeSelection:function(e){let t=this,n=e.sender.range(),r=e.sender._useEnd,i=e.sender._useStart,a=t.selectRange()||{},s,c,l=a.target;n.start&&n.start.length&&(s=o(n.start.find(`span`))),n.end&&n.end.length&&(c=o(n.end.find(`span`))),l=l===`end`?R:`end`,t._range={start:i?a.start:s,end:r?a.end:c,target:l},t._preventChange||t.trigger(x)},_selection:function(t){let n=this,r=t.sender.value(),i=t.event,a=e(i&&i.currentTarget),s=a.is(H),c;n._isSingleSelection()&&n._validateValue(r[0]?o(r.first().find(`span`)):t.sender._lastActive?o(t.sender._lastActive.find(`span`)):n.value()),n._isMultipleSelection()&&(s&&(c=o(a.find(`span`))),i&&i.ctrlKey?s?a.hasClass(T)?n._selectDates.push(c):n._deselect(c):(n.element.find(`table `+M).each(function(t,r){var i=o(e(r).find(`span`));n._deselect(i)}),n._addSelectedCellsToArray()):i&&i.shiftKey?n._selectRange(o(t.sender._lastActive?t.sender._lastActive.find(`span`):r.first().find(`span`)),c):s?(n._selectDates=[],n._selectDates.push(c)):(n._selectDates=[],n._addSelectedCellsToArray())),n._preventChange||n.trigger(x)},_addSelectedCellsToArray:function(){var t=this;t.selectable&&t.selectable.value().each(function(n,r){var i=o(e(r.firstChild));t.options.disableDates(i)||t._selectDates.push(i)})},_deselect:function(e){var t=this,n=t._selectDates.map(Number).indexOf(+e);n!=-1&&t._selectDates.splice(n,1)},_unselecting:function(e){var t=this,n=e.element;t._isSingleSelection()&&!g&&n.hasClass(w)&&e.preventDefault()},_visibleRange:function(){var e=this.element.find(`.`+A+` table`);return{start:o(e.first().find(j).first().find(`span`)),end:o(e.last().find(j).last().find(`span`))}},_dateInViews:function(e){var t=this.element.find(`.`+A+` table`),n=o(t.first().find(j).first().find(`span`)),r=o(t.last().find(j).last().find(`span`));if(e)return e=new Date(e.toDateString()),+e<=+r&&+e>=+n},_fillRange:function(e,t){var n=this,r;n._selectDates=[],r=ee(e,t),Q(n._selectDates,r,e,n.options.disableDates)},_selectRange:function(e,t){var n=this,r;+t<+e&&(r=t,t=e,e=r),n._fillRange(e,t),n._visualizeSelectedDatesInView()},_header:function(){var t=this,r=t.element,i,a=r.find(`.k-calendar-header`);a.length||(a=e(`<div class="k-calendar-header"><span id="calendar-title" tabindex="-1" data-href="#" role="button" class="k-calendar-title k-button ${n.getValidCssClass(`k-button-`,`size`,t.options.size)} k-button-flat k-button-primary" aria-live="polite"></span><span class="k-spacer"></span><span class="k-calendar-nav"><span tabindex="-1" data-href="#" role="button" class="k-button ${n.getValidCssClass(`k-button-`,`size`,t.options.size)} k-button-flat k-icon-button k-calendar-nav-prev" aria-label="Previous">${n.ui.icon({icon:`chevron-left`,iconClass:`k-button-icon`})}</span><span tabindex="-1" data-href="#" role="button" class="k-button ${n.getValidCssClass(`k-button-`,`size`,t.options.size)} k-button-flat k-icon-button k-calendar-nav-next" aria-label="Next">${n.ui.icon({icon:`chevron-right`,iconClass:`k-button-icon`})}</span></span></div>`).prependTo(r)),t.header=a,a.on(P+_+` `+F+` focus.kendoMultiViewCalendar blur.kendoMultiViewCalendar`,`.k-button`,Z).on(v,function(){return!1}).on(v+_,`.k-button.k-calendar-title`,t._calendarTitleClick.bind(t)).on(v+_,`.k-button.k-calendar-nav-prev`,t._prevViewClick.bind(t)).on(v+_,`.k-button.k-calendar-nav-next`,t._nextViewClick.bind(t)),i=a.find(`.k-button`),t._title=i.filter(`.k-calendar-title`),t._navContainer=a.find(`.k-calendar-nav`),t[I]=i.filter(`.k-calendar-nav-prev`),t[L]=i.filter(`.k-calendar-nav-next`)},_calendarTitleClick:function(){this.navigateUp(),this.focus(),this.trigger(S)},_prevViewClick:function(e){e.preventDefault(),this.navigateToPast(),this.focus(),this.trigger(S)},_nextViewClick:function(e){e.preventDefault(),this.navigateToFuture(),this.focus(),this.trigger(S)},_wrapper:function(){this.tablesWrapper=e(`<div tabindex="0" role="grid" class="k-calendar-view" aria-labelledby="calendar-title" />`).insertAfter(this.element[0].firstChild)},_templates:function(){var e=this,t=e.options.month,r=t.content,i=t.weekNumber,a=t.empty;e.month={content:h(e=>`<td class="${e.cssClass}" role="gridcell"><span tabindex="-1" class="k-link${e.linkClass}" data-href="${e.url}" ${n.attr(C)}="${e.dateString}" title="${e.title}">${r?n.template(r,{useWithBlock:!!r})(e):e.value}</span></td>`,{useWithBlock:!!r}),empty:h(e=>`<td role="gridcell"${a?`>`:` class="k-calendar-td k-empty">`}${a?n.template(a,{useWithBlock:!!a})(e):`</span>`}</td>`,{useWithBlock:!!a}),weekNumber:h(e=>`<td class="k-calendar-td k-alt">${i?n.template(i,{useWithBlock:!!i})(e):e.weekNumber}</td>`,{useWithBlock:!!i})}},_footer:function(){var t=this,r=t.options,i=r.footer===!1?null:n.template(t.options.footer||(e=>n.toString(e,`D`,r.culture)),{useWithBlock:!1}),a=l(),o=t.element,s=o.find(`.k-calendar-footer`);if(!i){t._toggle(!1),s.hide();return}s[0]||(s=e(`<div class="k-calendar-footer"> <button tabindex="-1" class="k-calendar-nav-today k-button ${n.getValidCssClass(`k-button-`,`size`,t.options.size)} k-button-flat k-button-primary"> <span class="k-button-text"></span> </button> </div>`).appendTo(o)),t._today=s.show().find(`.k-button-flat.k-button-primary`).attr(`title`,n.toString(a,`D`,t.options.culture)),s.find(`.k-button-text`).html(i(a)),t._toggle()},_navigate:function(e,t){var n=this,i=n._index+1,a=new J(+n._current),o=new J(+n._current),s;e=n[e],s=n._cellByDate(a).closest(z).index(),t>0?s=1-s:s+=1,(!e||!e.hasClass(D))&&(i>3?a.setFullYear(a.getFullYear()+t*s*100):r.views[i].setDate(a,t*s),n.navigate(a),n._dateInViews(o)?(n._focusCell(n._cellByDate(o)),n._current=o):(i>3?o.setFullYear(o.getFullYear()+100*t):r.views[i].setDate(o,t),n._focusCell(n._cellByDate(o)),n._current=o))},_toggle:function(e){var n=this,r=n.options,i=r.selectable!==`range`&&n.options.disableDates(l()),o=n._today;e===t&&(e=a(l(),r.min,r.max)),o&&(o.off(v+_),e&&!i?o.addClass(O).removeClass(D).on(v+_,function(e){n._todayClick(e),n.focus()}):o.removeClass(O).addClass(D).on(v+_,function(e){e.preventDefault()}))},_click:function(e){var t=this,i=t.options,a=new Date(+t._current),s=o(e);n.date.adjustDST(s,0),t._currentView.setDate(a,s),t._current=s,t._currentView.name===i.depth?t._focusCell(e.closest(H)):(t.navigateDown(r.restrictValue(a,i.min,i.max)),t._focusCell(t._cellByDate(t._current)),t.trigger(S)),t.focus()},_blur:function(){var e=this;e._cell&&e._cell.removeClass(w)},_focus:function(){var t=this._cell;(!t||!e.contains(this.tablesWrapper[0],t[0]))&&(t=this._current&&this._dateInViews(this._current)?this._cellByDate(this._current):this.tablesWrapper.find(M).first()),this._focusCell(t)},_focusCell:function(e){var t=this,n=t._cellID;t._cell&&t._cell.length&&(t._cell[0].removeAttribute(K),t._cell.removeClass(w),t.tablesWrapper.removeAttr(q),t._cell.attr(`id`)===n&&t._cell[0].removeAttribute(`id`)),t._cell=e,e.attr(`id`)?t.tablesWrapper.attr(q,e.attr(`id`)):n&&(e.attr(`id`,n),t.tablesWrapper.attr(q,n)),e.addClass(w),e.length&&t._currentView.name==y&&(t._current=o(e.find(`span`)))},_todayClick:function(e){var t=this,n=t.options.disableDates,r=l(),i=!1;e.preventDefault(),!n(r)&&(t._value=r,t._isMultipleSelection()&&(t._selectDates=[r]),t._isRangeSelection()&&(t.rangeSelectable.clear(!0),t._range={start:r,end:null}),(t._currentView.name!=y||!t._dateInViews(r))&&(i=!0),t.navigate(r,t.options.depth),t._isSingleSelection()&&(t.selectable._lastActive=null),i&&t.trigger(S),t.trigger(x))},_validateValue:function(e){var r=this,i=r.options,o=i.min,s=i.max;return e=n.parseDate(e,i.format,i.culture),e!==null&&(e=new J(+e),a(e,o,s)||(e=null)),e===null||!r.options.disableDates(new Date(+e))?r._value=e:r._value===t&&(r._value=null),r._value},_updateAria:function(e,t){var r=this,i=r._cellByDate(t||r.current()),a=r.view().valueType(),o=t||r.current(),s;return r._focusCell(i),s=a===y?n.toString(o,`MMMM`):a===`date`?n.toString(o,`D`):i.text(),i.attr(K,e({current:o,valueType:a,text:s})),i.attr(`id`)},clearSelection:function(){var e=this;e.selectable&&e.element.find(`.`+T).removeClass(T).removeAttr(`aria-selected`),e.rangeSelectable&&e.rangeSelectable.clear(!0)},_restoreSelection:function(){var e=this,t;if(e._currentView.name===e.options.depth){if(e._preventChange=!0,e._isRangeSelection()){if(t=e.selectRange(),!t||!t.start){e._preventChange=!1;return}e.selectRange(t)}e._isSingleSelection()&&e.value()&&e.selectable.value(e._cellByDate(e.value())),e._isMultipleSelection()&&e._visualizeSelectedDatesInView(),e._preventChange=!1}},_isMultipleSelection:function(){let e=this.options.selectable;return p.parseOptions(e).multiple},_isRangeSelection:function(){let e=this.options.selectable;return p.parseOptions(e).range},_isSingleSelection:function(){let e=this.options.selectable;return p.parseOptions(e).single},value:function(e){var n=this,r;if(e===t)return n._value;e=n._validateValue(e),n.clearSelection(),e&&!n._dateInViews(e)&&n.navigate(e),e!==null&&n._currentView.name===y&&(r=n._cellByDate(e),n.selectable&&n.selectable.value(r),n.rangeSelectable&&(n.rangeSelectable.start(r),n.rangeSelectable._lastActive=r))},selectDates:function(n){var r=this,i,a;if(n===t)return r._selectDates;a=n.map(function(e){return e.getTime()}).filter(function(e,t,n){return n.indexOf(e)===t}).map(function(e){return new Date(e)}),i=e.grep(a,function(e){if(e)return+r._validateValue(new Date(e.setHours(0,0,0,0)))==+e}),r._selectDates=i.length>0?i:a.length===0?a:r._selectDates,r._visualizeSelectedDatesInView()},selectRange:function(e){let n=this,r,i,a;if(e===t)return n._range;n._range=e,a=n._visibleRange(),r=n._dateInViews(e.start),i=e.end&&n._dateInViews(e.end),r||(i?e.start?n.rangeSelectable.selectTo(n._cellByDate(e.end)):(n.rangeSelectable.clear(!0),n.rangeSelectable.end(n._cellByDate(e.end))):e.start&&n.rangeSelectable.start(n._cellByDate(e.start))),r&&i&&n.rangeSelectable.range(n._cellByDate(e.start),n._cellByDate(e.end),!1,n.options.allowReverse),e.end&&r&&!i&&n.rangeSelectable.selectFrom(n._cellByDate(e.start)),!e.end&&r&&(n.rangeSelectable.clear(!0),n.rangeSelectable.start(n._cellByDate(e.start))),+a.start>+e.start&&+a.end<+e.end&&n.rangeSelectable.mid(n.element.find(M))}});n.ui.plugin(X);function Z(t){e(this).hasClass(`k-disabled`)||e(this).toggleClass(E,P.indexOf(t.type)>-1||t.type==N)}function Q(e,t,n,r){for(var i=0;i<=t;i++){var a=new Date(n.getTime());a=new Date(a.setDate(a.getDate()+i)),r(a)||e.push(a)}}function ee(e,t){if(+t<+e){var i=+e;r.views[0].setDate(e,t),r.views[0].setDate(t,new Date(i))}var a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),o=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.ceil((o-+a)/n.date.MS_PER_DAY)}function $(e,t,n){var i;if(t===y)return i=new J(e.getFullYear(),e.getMonth()+n,e.getDate()),i.setFullYear(e.getFullYear()),(Math.abs(i.getMonth()-e.getMonth())>n||n>10)&&(i.setMonth(e.getMonth()+n),i=r.views[0].last(i)),i;if(t===`year`)return i=new J(1,e.getMonth(),e.getDate()),i.setFullYear(e.getFullYear()+n),Math.abs(i.getFullYear()-e.getFullYear())>n&&(i=new J(1,e.getMonth(),1),i.setFullYear(e.getFullYear()+n),i=r.views[1].last(i)),i;if(t===`decade`)return i=new J(1,e.getMonth(),e.getDate()),i.setFullYear(e.getFullYear()+10*n),Math.abs(i.getFullYear()-e.getFullYear())>10*n&&(i=new J(1,e.getMonth(),1),i.setFullYear(e.getFullYear()+10*n),i=r.views[2].last(i)),i;if(t===`century`)return i=new J(1,e.getMonth(),e.getDate()),i.setFullYear(e.getFullYear()+100*n),Math.abs(i.getFullYear()-e.getFullYear())>100*n&&(i=new J(1,e.getMonth(),1),i.setFullYear(e.getFullYear()+100*n),i=r.views[3].last(i)),i}})(window.kendo.jQuery);var o=kendo;e.__meta__=a,e.default=o}); //# sourceMappingURL=kendo.multiviewcalendar.min.js.map