ng2-date-picker
Version:
[](https://travis-ci.org/vlio20/angular-datepicker) [](#backers) [![Sponsor
1 lines • 82 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("@angular/common"),require("moment")):"function"==typeof define&&define.amd?define("ng2-date-picker",["exports","@angular/core","@angular/forms","@angular/common","moment"],t):t((e=e||self)["ng2-date-picker"]={},e.ng.core,e.ng.forms,e.ng.common,e.momentNs)}(this,function(e,t,n,i,o){"use strict";var r,a,s,c=function(){return(c=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function l(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}(r=e.ECalendarMode||(e.ECalendarMode={}))[r.Day=0]="Day",r[r.DayTime=1]="DayTime",r[r.Month=2]="Month",r[r.Time=3]="Time",(a=e.ECalendarValue||(e.ECalendarValue={}))[a.Moment=1]="Moment",a[a.MomentArr=2]="MomentArr",a[a.String=3]="String",a[a.StringArr=4]="StringArr",(s=e.SelectEvent||(e.SelectEvent={})).INPUT="input",s.SELECTION="selection";var p=function(){function e(){}var n;return n=e,e.setYAxisPosition=function(e,t,n,i){var o=n.getBoundingClientRect(),r=t.getBoundingClientRect(),a=o.bottom-r.top,s=o.top-r.top;e.style.top="down"===i?a+1+"px":s-1-e.scrollHeight+"px"},e.setXAxisPosition=function(e,t,n,i,o){var r=n.getBoundingClientRect(),a=t.getBoundingClientRect(),s=r.left-a.left;e.style.left="right"===o?s+"px":s-i.offsetWidth+n.offsetWidth+"px"},e.isTopInView=function(e){return e.getBoundingClientRect().top>=0},e.isBottomInView=function(e){return e.getBoundingClientRect().bottom<=window.innerHeight},e.isLeftInView=function(e){return e.getBoundingClientRect().left>=0},e.isRightInView=function(e){return e.getBoundingClientRect().right<=window.innerWidth},e.prototype.appendElementToPosition=function(e){var t=this,n=e.container,i=e.element;n.style.position&&"static"!==n.style.position||(n.style.position="relative"),"absolute"!==i.style.position&&(i.style.position="absolute"),i.style.visibility="hidden",setTimeout(function(){t.setElementPosition(e),i.style.visibility="visible"})},e.prototype.setElementPosition=function(e){var t=e.element,i=e.container,o=e.anchor,r=e.dimElem,a=e.drops,s=e.opens;n.setYAxisPosition(t,i,o,"down"),n.setXAxisPosition(t,i,o,r,"right"),"down"!==a&&"up"!==a?n.isBottomInView(r)?n.setYAxisPosition(t,i,o,"down"):n.isTopInView(r)&&n.setYAxisPosition(t,i,o,"up"):n.setYAxisPosition(t,i,o,a),"left"!==s&&"right"!==s?n.isRightInView(r)?n.setXAxisPosition(t,i,o,r,"right"):n.isLeftInView(r)&&n.setXAxisPosition(t,i,o,r,"left"):n.setXAxisPosition(t,i,o,r,s)},e=n=l([t.Injectable()],e)}(),h=o,u=function(){function n(){}return n.debounce=function(e,t){var n;return function(){var i=this,o=arguments;n=clearTimeout(n),setTimeout(function(){e.apply(i,o)},t)}},n.prototype.createArray=function(e){return new Array(e).fill(1)},n.prototype.convertToMoment=function(e,t){return e?"string"==typeof e?h(e,t):e.clone():null},n.prototype.isDateValid=function(e,t){return""===e||h(e,t,!0).isValid()},n.prototype.getDefaultDisplayDate=function(e,t,n,i){if(e)return e.clone();if(i&&i.isAfter(h()))return i.clone();if(n){if(t&&t[t.length])return t[t.length].clone()}else if(t&&t[0])return t[0].clone();return h()},n.prototype.getInputType=function(t,n){if(Array.isArray(t)){if(!t.length)return e.ECalendarValue.MomentArr;if("string"==typeof t[0])return e.ECalendarValue.StringArr;if(h.isMoment(t[0]))return e.ECalendarValue.MomentArr}else{if("string"==typeof t)return e.ECalendarValue.String;if(h.isMoment(t))return e.ECalendarValue.Moment}return n?e.ECalendarValue.MomentArr:e.ECalendarValue.Moment},n.prototype.convertToMomentArray=function(t,n,i){switch(this.getInputType(t,i)){case e.ECalendarValue.String:return t?[h(t,n,!0)]:[];case e.ECalendarValue.StringArr:return t.map(function(e){return e?h(e,n,!0):null}).filter(Boolean);case e.ECalendarValue.Moment:return t?[t.clone()]:[];case e.ECalendarValue.MomentArr:return(t||[]).map(function(e){return e.clone()});default:return[]}},n.prototype.convertFromMomentArray=function(t,n,i){switch(i){case e.ECalendarValue.String:return n[0]&&n[0].format(t);case e.ECalendarValue.StringArr:return n.filter(Boolean).map(function(e){return e.format(t)});case e.ECalendarValue.Moment:return n[0]?n[0].clone():n[0];case e.ECalendarValue.MomentArr:return n?n.map(function(e){return e.clone()}):n;default:return n}},n.prototype.convertToString=function(e,t){var n,i=this;if("string"==typeof e)n=[e];else if(Array.isArray(e))n=e.length?e.map(function(e){return i.convertToMoment(e,t).format(t)}):e;else{if(!h.isMoment(e))return"";n=[e.format(t)]}return n.filter(Boolean).join(" | ")},n.prototype.clearUndefined=function(e){return e?(Object.keys(e).forEach(function(t){return e[t]===undefined&&delete e[t]}),e):e},n.prototype.updateSelected=function(e,t,n,i){return void 0===i&&(i="day"),e?n.selected?t.filter(function(e){return!e.isSame(n.date,i)}):t.concat([n.date]):n.selected?[]:[n.date]},n.prototype.closestParent=function(e,t){return e?e.querySelector(t)||this.closestParent(e.parentElement,t):undefined},n.prototype.onlyTime=function(e){return e&&h.isMoment(e)&&h(e.format("HH:mm:ss"),"HH:mm:ss")},n.prototype.granularityFromType=function(e){switch(e){case"time":case"daytime":return"second";default:return e}},n.prototype.createValidator=function(e,t,n){var i,o,r=this,a=e.minDate,s=e.maxDate,c=e.minTime,l=e.maxTime,d=[],p=this.granularityFromType(n);if(a){var h=this.convertToMoment(a,t);d.push({key:"minDate",isValid:function(){var e=o.every(function(e){return e.isSameOrAfter(h,p)});return i=!!i&&e,e}})}if(s){var u=this.convertToMoment(s,t);d.push({key:"maxDate",isValid:function(){var e=o.every(function(e){return e.isSameOrBefore(u,p)});return i=!!i&&e,e}})}if(c){var m=this.onlyTime(this.convertToMoment(c,t));d.push({key:"minTime",isValid:function(){var e=o.every(function(e){return r.onlyTime(e).isSameOrAfter(m)});return i=!!i&&e,e}})}if(l){var f=this.onlyTime(this.convertToMoment(l,t));d.push({key:"maxTime",isValid:function(){var e=o.every(function(e){return r.onlyTime(e).isSameOrBefore(f)});return i=!!i&&e,e}})}return function(e){if(i=!0,!(o=r.convertToMomentArray(e,t,!0).filter(Boolean)).every(function(e){return e.isValid()}))return{format:{given:e}};var n=d.reduce(function(e,t){return t.isValid()||(e[t.key]={given:o}),e},{});return i?null:n}},n.prototype.datesStringToStringArray=function(e){return(e||"").split("|").map(function(e){return e.trim()}).filter(Boolean)},n.prototype.getValidMomentArray=function(e,t){var n=this;return this.datesStringToStringArray(e).filter(function(e){return n.isDateValid(e,t)}).map(function(e){return h(e,t)})},n.prototype.shouldShowCurrent=function(e,t,n,i){return e&&"time"!==t&&this.isDateInRange(h(),n,i)},n.prototype.isDateInRange=function(e,t,n){return e.isBetween(t,n,"day","[]")},n.prototype.convertPropsToMoment=function(e,t,n){var i=this;n.forEach(function(n){e.hasOwnProperty(n)&&(e[n]=i.convertToMoment(e[n],t))})},n.prototype.shouldResetCurrentView=function(e,t){return!(!e||!t)&&(!(e.min||!t.min)||(!(!e.min||!t.min||e.min.isSame(t.min,"d"))||(!(e.max||!t.max)||!(!e.max||!t.max||e.max.isSame(t.max,"d")))))},n.prototype.getNativeElement=function(e){return e?"string"==typeof e?document.querySelector(e):e:null},n=l([t.Injectable()],n)}(),m=o,f=function(){function e(e){this.utilsService=e,this.DAYS=["su","mo","tu","we","th","fr","sa"],this.DEFAULT_CONFIG={showNearMonthDays:!0,showWeekNumbers:!1,firstDayOfWeek:"su",weekDayFormat:"ddd",format:"DD-MM-YYYY",allowMultiSelect:!1,monthFormat:"MMM, YYYY",enableMonthSelector:!0,locale:m.locale(),dayBtnFormat:"DD",unSelectOnClick:!0}}return e.prototype.removeNearMonthWeeks=function(e,t){return t[t.length-1].find(function(t){return t.date.isSame(e,"month")})?t:t.slice(0,-1)},e.prototype.getConfig=function(e){var t=c({},this.DEFAULT_CONFIG,this.utilsService.clearUndefined(e));return this.utilsService.convertPropsToMoment(t,t.format,["min","max"]),m.locale(t.locale),t},e.prototype.generateDaysMap=function(e){var t=this.DAYS.indexOf(e);return this.DAYS.slice(t,7).concat(this.DAYS.slice(0,t)).reduce(function(e,t,n){return e[t]=n,e},{})},e.prototype.generateMonthArray=function(e,t,n){for(var i=this,o=[],r=this.DAYS.indexOf(e.firstDayOfWeek),a=t.clone().startOf("month");a.day()!==r;)a.subtract(1,"day");var s=a.clone(),c=t.clone().subtract(1,"month"),l=t.clone().add(1,"month"),d=m();return this.utilsService.createArray(42).reduce(function(o){return o.push({date:s.clone(),selected:!!n.find(function(e){return s.isSame(e,"day")}),currentMonth:s.isSame(t,"month"),prevMonth:s.isSame(c,"month"),nextMonth:s.isSame(l,"month"),currentDay:s.isSame(d,"day"),disabled:i.isDateDisabled(s,e)}),s.add(1,"day"),o},[]).forEach(function(e,t){var n=Math.floor(t/7);o[n]||o.push([]),o[n].push(e)}),e.showNearMonthDays||(o=this.removeNearMonthWeeks(t,o)),o},e.prototype.generateWeekdays=function(e){var t={su:m().day(0),mo:m().day(1),tu:m().day(2),we:m().day(3),th:m().day(4),fr:m().day(5),sa:m().day(6)},n=[],i=this.generateDaysMap(e);for(var o in i)i.hasOwnProperty(o)&&(n[i[o]]=t[o]);return n},e.prototype.isDateDisabled=function(e,t){return t.isDayDisabledCallback?t.isDayDisabledCallback(e):!(!t.min||!e.isBefore(t.min,"day"))||!(!t.max||!e.isAfter(t.max,"day"))},e.prototype.getHeaderLabel=function(e,t){return e.monthFormatter?e.monthFormatter(t):t.format(e.monthFormat)},e.prototype.shouldShowLeft=function(e,t){return!e||e.isBefore(t,"month")},e.prototype.shouldShowRight=function(e,t){return!e||e.isAfter(t,"month")},e.prototype.generateDaysIndexMap=function(e){var t=this.DAYS.indexOf(e);return this.DAYS.slice(t,7).concat(this.DAYS.slice(0,t)).reduce(function(e,t,n){return e[n]=t,e},{})},e.prototype.getMonthCalendarConfig=function(e){return this.utilsService.clearUndefined({min:e.min,max:e.max,format:e.format,isNavHeaderBtnClickable:!0,allowMultiSelect:!1,yearFormat:e.yearFormat,yearFormatter:e.yearFormatter,monthBtnFormat:e.monthBtnFormat,monthBtnFormatter:e.monthBtnFormatter,monthBtnCssClassCallback:e.monthBtnCssClassCallback,multipleYearsNavigateBy:e.multipleYearsNavigateBy,showMultipleYearsNavigation:e.showMultipleYearsNavigation,showGoToCurrent:e.showGoToCurrent})},e.prototype.getDayBtnText=function(e,t){return e.dayBtnFormatter?e.dayBtnFormatter(t):t.format(e.dayBtnFormat)},e.prototype.getDayBtnCssClass=function(e,t){return e.dayBtnCssClassCallback?e.dayBtnCssClassCallback(t):""},e=l([t.Injectable(),d("design:paramtypes",[u])],e)}(),y=o,g=function(){function i(n,i,o){this.dayCalendarService=n,this.utilsService=i,this.cd=o,this.onSelect=new t.EventEmitter,this.onMonthSelect=new t.EventEmitter,this.onNavHeaderBtnClick=new t.EventEmitter,this.onGoToCurrent=new t.EventEmitter,this.onLeftNav=new t.EventEmitter,this.onRightNav=new t.EventEmitter,this.CalendarMode=e.ECalendarMode,this.isInited=!1,this.currentCalendarMode=e.ECalendarMode.Day,this._shouldShowCurrent=!0,this.api={moveCalendarsBy:this.moveCalendarsBy.bind(this),moveCalendarTo:this.moveCalendarTo.bind(this),toggleCalendarMode:this.toggleCalendarMode.bind(this)}}var o;return o=i,Object.defineProperty(i.prototype,"selected",{get:function(){return this._selected},set:function(e){this._selected=e,this.onChangeCallback(this.processOnChangeCallback(e))},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentDateView",{get:function(){return this._currentDateView},set:function(e){this._currentDateView=e.clone(),this.weeks=this.dayCalendarService.generateMonthArray(this.componentConfig,this._currentDateView,this.selected),this.navLabel=this.dayCalendarService.getHeaderLabel(this.componentConfig,this._currentDateView),this.showLeftNav=this.dayCalendarService.shouldShowLeft(this.componentConfig.min,this.currentDateView),this.showRightNav=this.dayCalendarService.shouldShowRight(this.componentConfig.max,this.currentDateView)},enumerable:!0,configurable:!0}),i.prototype.ngOnInit=function(){this.isInited=!0,this.init(),this.initValidators()},i.prototype.init=function(){this.componentConfig=this.dayCalendarService.getConfig(this.config),this.selected=this.selected||[],this.currentDateView=this.displayDate?this.utilsService.convertToMoment(this.displayDate,this.componentConfig.format).clone():this.utilsService.getDefaultDisplayDate(this.currentDateView,this.selected,this.componentConfig.allowMultiSelect,this.componentConfig.min),this.weekdays=this.dayCalendarService.generateWeekdays(this.componentConfig.firstDayOfWeek),this.inputValueType=this.utilsService.getInputType(this.inputValue,this.componentConfig.allowMultiSelect),this.monthCalendarConfig=this.dayCalendarService.getMonthCalendarConfig(this.componentConfig),this._shouldShowCurrent=this.shouldShowCurrent()},i.prototype.ngOnChanges=function(e){if(this.isInited){var t=e.minDate,n=e.maxDate,i=e.config;this.handleConfigChange(i),this.init(),(t||n)&&this.initValidators()}},i.prototype.writeValue=function(e){this.inputValue=e,e?(this.selected=this.utilsService.convertToMomentArray(e,this.componentConfig.format,this.componentConfig.allowMultiSelect),this.inputValueType=this.utilsService.getInputType(this.inputValue,this.componentConfig.allowMultiSelect)):this.selected=[],this.weeks=this.dayCalendarService.generateMonthArray(this.componentConfig,this.currentDateView,this.selected),this.cd.markForCheck()},i.prototype.registerOnChange=function(e){this.onChangeCallback=e},i.prototype.onChangeCallback=function(e){},i.prototype.registerOnTouched=function(e){},i.prototype.validate=function(e){return this.minDate||this.maxDate?this.validateFn(e.value):function(){return null}},i.prototype.processOnChangeCallback=function(e){return this.utilsService.convertFromMomentArray(this.componentConfig.format,e,this.componentConfig.returnedValueType||this.inputValueType)},i.prototype.initValidators=function(){this.validateFn=this.utilsService.createValidator({minDate:this.minDate,maxDate:this.maxDate},this.componentConfig.format,"day"),this.onChangeCallback(this.processOnChangeCallback(this.selected))},i.prototype.dayClicked=function(e){e.selected&&!this.componentConfig.unSelectOnClick||(this.selected=this.utilsService.updateSelected(this.componentConfig.allowMultiSelect,this.selected,e),this.weeks=this.dayCalendarService.generateMonthArray(this.componentConfig,this.currentDateView,this.selected),this.onSelect.emit(e))},i.prototype.getDayBtnText=function(e){return this.dayCalendarService.getDayBtnText(this.componentConfig,e.date)},i.prototype.getDayBtnCssClass=function(e){var t={"dp-selected":e.selected,"dp-current-month":e.currentMonth,"dp-prev-month":e.prevMonth,"dp-next-month":e.nextMonth,"dp-current-day":e.currentDay},n=this.dayCalendarService.getDayBtnCssClass(this.componentConfig,e.date);return n&&(t[n]=!0),t},i.prototype.onLeftNavClick=function(){var e=this.currentDateView.clone();this.moveCalendarsBy(this.currentDateView,-1,"month");var t=this.currentDateView.clone();this.onLeftNav.emit({from:e,to:t})},i.prototype.onRightNavClick=function(){var e=this.currentDateView.clone();this.moveCalendarsBy(this.currentDateView,1,"month");var t=this.currentDateView.clone();this.onRightNav.emit({from:e,to:t})},i.prototype.onMonthCalendarLeftClick=function(e){this.onLeftNav.emit(e)},i.prototype.onMonthCalendarRightClick=function(e){this.onRightNav.emit(e)},i.prototype.onMonthCalendarSecondaryLeftClick=function(e){this.onRightNav.emit(e)},i.prototype.onMonthCalendarSecondaryRightClick=function(e){this.onLeftNav.emit(e)},i.prototype.getWeekdayName=function(e){return this.componentConfig.weekDayFormatter?this.componentConfig.weekDayFormatter(e.day()):e.format(this.componentConfig.weekDayFormat)},i.prototype.toggleCalendarMode=function(e){this.currentCalendarMode!==e&&(this.currentCalendarMode=e,this.onNavHeaderBtnClick.emit(e)),this.cd.markForCheck()},i.prototype.monthSelected=function(t){this.currentDateView=t.date.clone(),this.currentCalendarMode=e.ECalendarMode.Day,this.onMonthSelect.emit(t)},i.prototype.moveCalendarsBy=function(e,t,n){void 0===n&&(n="month"),this.currentDateView=e.clone().add(t,n),this.cd.markForCheck()},i.prototype.moveCalendarTo=function(e){e&&(this.currentDateView=this.utilsService.convertToMoment(e,this.componentConfig.format)),this.cd.markForCheck()},i.prototype.shouldShowCurrent=function(){return this.utilsService.shouldShowCurrent(this.componentConfig.showGoToCurrent,"day",this.componentConfig.min,this.componentConfig.max)},i.prototype.goToCurrent=function(){this.currentDateView=y(),this.onGoToCurrent.emit()},i.prototype.handleConfigChange=function(e){if(e){var t=this.dayCalendarService.getConfig(e.previousValue),n=this.dayCalendarService.getConfig(e.currentValue);this.utilsService.shouldResetCurrentView(t,n)&&(this._currentDateView=null)}},l([t.Input(),d("design:type",Object)],i.prototype,"config",void 0),l([t.Input(),d("design:type",Object)],i.prototype,"displayDate",void 0),l([t.Input(),d("design:type",Object)],i.prototype,"minDate",void 0),l([t.Input(),d("design:type",Object)],i.prototype,"maxDate",void 0),l([t.HostBinding("class"),t.Input(),d("design:type",String)],i.prototype,"theme",void 0),l([t.Output(),d("design:type",t.EventEmitter)],i.prototype,"onSelect",void 0),l([t.Output(),d("design:type",t.EventEmitter)],i.prototype,"onMonthSelect",void 0),l([t.Output(),d("design:type",t.EventEmitter)],i.prototype,"onNavHeaderBtnClick",void 0),l([t.Output(),d("design:type",t.EventEmitter)],i.prototype,"onGoToCurrent",void 0),l([t.Output(),d("design:type",t.EventEmitter)],i.prototype,"onLeftNav",void 0),l([t.Output(),d("design:type",t.EventEmitter)],i.prototype,"onRightNav",void 0),i=o=l([t.Component({selector:"dp-day-calendar",template:'<div class="dp-day-calendar-container" *ngIf="currentCalendarMode === CalendarMode.Day">\n <dp-calendar-nav\n [label]="navLabel"\n [showLeftNav]="showLeftNav"\n [showRightNav]="showRightNav"\n [isLabelClickable]="componentConfig.enableMonthSelector"\n [showGoToCurrent]="_shouldShowCurrent"\n [theme]="theme"\n (onLeftNav)="onLeftNavClick()"\n (onRightNav)="onRightNavClick()"\n (onLabelClick)="toggleCalendarMode(CalendarMode.Month)"\n (onGoToCurrent)="goToCurrent()">\n </dp-calendar-nav>\n\n <div class="dp-calendar-wrapper"\n [ngClass]="{\'dp-hide-near-month\': !componentConfig.showNearMonthDays}">\n <div class="dp-weekdays">\n <span class="dp-calendar-weekday"\n *ngFor="let weekday of weekdays"\n [innerText]="getWeekdayName(weekday)">\n </span>\n </div>\n <div class="dp-calendar-week" *ngFor="let week of weeks">\n <span class="dp-week-number"\n *ngIf="componentConfig.showWeekNumbers"\n [innerText]="week[0].date.isoWeek()">\n </span>\n <button type="button"\n class="dp-calendar-day"\n *ngFor="let day of week"\n [attr.data-date]="day.date.format(componentConfig.format)"\n (click)="dayClicked(day)"\n [disabled]="day.disabled"\n [ngClass]="getDayBtnCssClass(day)"\n [innerText]="getDayBtnText(day)">\n </button>\n </div>\n </div>\n</div>\n\n<dp-month-calendar\n *ngIf="currentCalendarMode === CalendarMode.Month"\n [config]="monthCalendarConfig"\n [displayDate]="_currentDateView"\n [theme]="theme"\n (onSelect)="monthSelected($event)"\n (onNavHeaderBtnClick)="toggleCalendarMode(CalendarMode.Day)"\n (onLeftNav)="onMonthCalendarLeftClick($event)"\n (onRightNav)="onMonthCalendarRightClick($event)"\n (onLeftSecondaryNav)="onMonthCalendarSecondaryLeftClick($event)"\n (onRightSecondaryNav)="onMonthCalendarSecondaryRightClick($event)">\n</dp-month-calendar>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[f,{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return o}),multi:!0},{provide:n.NG_VALIDATORS,useExisting:t.forwardRef(function(){return o}),multi:!0}],styles:["dp-day-calendar{display:inline-block}dp-day-calendar .dp-day-calendar-container{background:#fff}dp-day-calendar .dp-calendar-wrapper{box-sizing:border-box;border:1px solid #000}dp-day-calendar .dp-calendar-wrapper .dp-calendar-weekday:first-child{border-left:none}dp-day-calendar .dp-weekdays{font-size:15px;margin-bottom:5px}dp-day-calendar .dp-calendar-weekday{box-sizing:border-box;display:inline-block;width:30px;text-align:center;border-left:1px solid #000;border-bottom:1px solid #000}dp-day-calendar .dp-calendar-day{box-sizing:border-box;width:30px;height:30px;cursor:pointer}dp-day-calendar .dp-selected{background:#106cc8;color:#fff}dp-day-calendar .dp-next-month,dp-day-calendar .dp-prev-month{opacity:.5}dp-day-calendar .dp-hide-near-month .dp-next-month,dp-day-calendar .dp-hide-near-month .dp-prev-month{visibility:hidden}dp-day-calendar .dp-week-number{position:absolute;font-size:9px}dp-day-calendar.dp-material .dp-calendar-weekday{height:25px;width:30px;line-height:25px;color:#7a7a7a;border:none}dp-day-calendar.dp-material .dp-calendar-wrapper{border:1px solid #e0e0e0}dp-day-calendar.dp-material .dp-calendar-day,dp-day-calendar.dp-material .dp-calendar-month{box-sizing:border-box;background:#fff;border-radius:50%;border:none;outline:0}dp-day-calendar.dp-material .dp-calendar-day:hover,dp-day-calendar.dp-material .dp-calendar-month:hover{background:#e0e0e0}dp-day-calendar.dp-material .dp-selected{background:#106cc8;color:#fff}dp-day-calendar.dp-material .dp-selected:hover{background:#106cc8}dp-day-calendar.dp-material .dp-current-day{border:1px solid #106cc8}"]}),d("design:paramtypes",[f,u,t.ChangeDetectorRef])],i)}(),v=o,C=function(){function e(e){this.utilsService=e,this.DEFAULT_CONFIG={hours12Format:"hh",hours24Format:"HH",meridiemFormat:"A",minutesFormat:"mm",minutesInterval:1,secondsFormat:"ss",secondsInterval:1,showSeconds:!1,showTwentyFourHours:!1,timeSeparator:":",locale:v.locale()}}return e.prototype.getConfig=function(e){var t={maxTime:this.utilsService.onlyTime(e&&e.maxTime),minTime:this.utilsService.onlyTime(e&&e.minTime)},n=c({},this.DEFAULT_CONFIG,this.utilsService.clearUndefined(e),t);return v.locale(n.locale),n},e.prototype.getTimeFormat=function(e){return(e.showTwentyFourHours?e.hours24Format:e.hours12Format)+e.timeSeparator+e.minutesFormat+(e.showSeconds?e.timeSeparator+e.secondsFormat:"")+(e.showTwentyFourHours?"":" "+e.meridiemFormat)},e.prototype.getHours=function(e,t){var n=t||v();return n&&n.format(e.showTwentyFourHours?e.hours24Format:e.hours12Format)},e.prototype.getMinutes=function(e,t){var n=t||v();return n&&n.format(e.minutesFormat)},e.prototype.getSeconds=function(e,t){var n=t||v();return n&&n.format(e.secondsFormat)},e.prototype.getMeridiem=function(e,t){return t&&t.format(e.meridiemFormat)},e.prototype.decrease=function(e,t,n){var i=1;switch(n){case"minute":i=e.minutesInterval;break;case"second":i=e.secondsInterval}return t.clone().subtract(i,n)},e.prototype.increase=function(e,t,n){var i=1;switch(n){case"minute":i=e.minutesInterval;break;case"second":i=e.secondsInterval}return t.clone().add(i,n)},e.prototype.toggleMeridiem=function(e){return e.hours()<12?e.clone().add(12,"hour"):e.clone().subtract(12,"hour")},e.prototype.shouldShowDecrease=function(e,t,n){if(!e.min&&!e.minTime)return!0;var i=this.decrease(e,t,n);return(!e.min||e.min.isSameOrBefore(i))&&(!e.minTime||e.minTime.isSameOrBefore(this.utilsService.onlyTime(i)))},e.prototype.shouldShowIncrease=function(e,t,n){if(!e.max&&!e.maxTime)return!0;var i=this.increase(e,t,n);return(!e.max||e.max.isSameOrAfter(i))&&(!e.maxTime||e.maxTime.isSameOrAfter(this.utilsService.onlyTime(i)))},e.prototype.shouldShowToggleMeridiem=function(e,t){if(!(e.min||e.max||e.minTime||e.maxTime))return!0;var n=this.toggleMeridiem(t);return(!e.max||e.max.isSameOrAfter(n))&&(!e.min||e.min.isSameOrBefore(n))&&(!e.maxTime||e.maxTime.isSameOrAfter(this.utilsService.onlyTime(n)))&&(!e.minTime||e.minTime.isSameOrBefore(this.utilsService.onlyTime(n)))},e=l([t.Injectable(),d("design:paramtypes",[u])],e)}(),b=o,S=function(){function e(e,t,n){this.utilsService=e,this.dayCalendarService=t,this.timeSelectService=n,this.DEFAULT_CONFIG={locale:b.locale()}}return e.prototype.getConfig=function(e){var t=c({},this.DEFAULT_CONFIG,this.timeSelectService.getConfig(e),this.dayCalendarService.getConfig(e));return b.locale(e.locale),t},e.prototype.updateDay=function(e,t,n){var i=e||b(),o=b(t.format("YYYYMMDD")+i.format("HH:mm:ss"),"YYYYMMDDHH:mm:ss");if(n.min){var r=n.min;o=r.isAfter(o)?r:o}if(n.max){var a=n.max;o=a.isBefore(o)?a:o}return o},e.prototype.updateTime=function(e,t){var n=e||b();return b(n.format("YYYYMMDD")+t.format("HH:mm:ss"),"YYYYMMDDHH:mm:ss")},e=l([t.Injectable(),d("design:paramtypes",[u,f,C])],e)}(),w=o,k=function(){function e(e,n,i){this.timeSelectService=e,this.utilsService=n,this.cd=i,this.onChange=new t.EventEmitter,this.isInited=!1,this.api={triggerChange:this.emitChange.bind(this)}}var i;return i=e,Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected},set:function(e){this._selected=e,this.calculateTimeParts(this.selected),this.showDecHour=this.timeSelectService.shouldShowDecrease(this.componentConfig,this._selected,"hour"),this.showDecMinute=this.timeSelectService.shouldShowDecrease(this.componentConfig,this._selected,"minute"),this.showDecSecond=this.timeSelectService.shouldShowDecrease(this.componentConfig,this._selected,"second"),this.showIncHour=this.timeSelectService.shouldShowIncrease(this.componentConfig,this._selected,"hour"),this.showIncMinute=this.timeSelectService.shouldShowIncrease(this.componentConfig,this._selected,"minute"),this.showIncSecond=this.timeSelectService.shouldShowIncrease(this.componentConfig,this._selected,"second"),this.showToggleMeridiem=this.timeSelectService.shouldShowToggleMeridiem(this.componentConfig,this._selected),this.onChangeCallback(this.processOnChangeCallback(e))},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.isInited=!0,this.init(),this.initValidators()},e.prototype.init=function(){this.componentConfig=this.timeSelectService.getConfig(this.config),this.selected=this.selected||w(),this.inputValueType=this.utilsService.getInputType(this.inputValue,!1)},e.prototype.ngOnChanges=function(e){if(this.isInited){var t=e.minDate,n=e.maxDate,i=e.minTime,o=e.maxTime;this.init(),(t||n||i||o)&&this.initValidators()}},e.prototype.writeValue=function(e){if(this.inputValue=e,e){var t=this.utilsService.convertToMomentArray(e,this.timeSelectService.getTimeFormat(this.componentConfig),!1)[0];t.isValid()&&(this.selected=t,this.inputValueType=this.utilsService.getInputType(this.inputValue,!1))}this.cd.markForCheck()},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.onChangeCallback=function(e){},e.prototype.registerOnTouched=function(e){},e.prototype.validate=function(e){return this.minDate||this.maxDate||this.minTime||this.maxTime?this.validateFn(e.value):function(){return null}},e.prototype.processOnChangeCallback=function(e){return this.utilsService.convertFromMomentArray(this.timeSelectService.getTimeFormat(this.componentConfig),[e],this.componentConfig.returnedValueType||this.inputValueType)},e.prototype.initValidators=function(){this.validateFn=this.utilsService.createValidator({minDate:this.minDate,maxDate:this.maxDate,minTime:this.minTime,maxTime:this.maxTime},undefined,"day"),this.onChangeCallback(this.processOnChangeCallback(this.selected))},e.prototype.decrease=function(e){this.selected=this.timeSelectService.decrease(this.componentConfig,this.selected,e),this.emitChange()},e.prototype.increase=function(e){this.selected=this.timeSelectService.increase(this.componentConfig,this.selected,e),this.emitChange()},e.prototype.toggleMeridiem=function(){this.selected=this.timeSelectService.toggleMeridiem(this.selected),this.emitChange()},e.prototype.emitChange=function(){this.onChange.emit({date:this.selected,selected:!1}),this.cd.markForCheck()},e.prototype.calculateTimeParts=function(e){this.hours=this.timeSelectService.getHours(this.componentConfig,e),this.minutes=this.timeSelectService.getMinutes(this.componentConfig,e),this.seconds=this.timeSelectService.getSeconds(this.componentConfig,e),this.meridiem=this.timeSelectService.getMeridiem(this.componentConfig,e)},l([t.Input(),d("design:type",Object)],e.prototype,"config",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"displayDate",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"minDate",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"maxDate",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"minTime",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"maxTime",void 0),l([t.HostBinding("class"),t.Input(),d("design:type",String)],e.prototype,"theme",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onChange",void 0),e=i=l([t.Component({selector:"dp-time-select",template:'<ul class="dp-time-select-controls">\n <li class="dp-time-select-control dp-time-select-control-hours">\n <button type="button"\n class="dp-time-select-control-up"\n [disabled]="!showIncHour"\n (click)="increase(\'hour\')">\n </button>\n <span class="dp-time-select-display-hours"\n [innerText]="hours">\n </span>\n <button type="button"\n class="dp-time-select-control-down"\n [disabled]="!showDecHour"\n (click)="decrease(\'hour\')"></button>\n </li>\n <li class="dp-time-select-control dp-time-select-separator"\n [innerText]="componentConfig.timeSeparator">\n </li>\n <li class="dp-time-select-control dp-time-select-control-minutes">\n <button type="button"\n class="dp-time-select-control-up"\n [disabled]="!showIncMinute"\n (click)="increase(\'minute\')"></button>\n <span class="dp-time-select-display-minutes"\n [innerText]="minutes">\n </span>\n <button type="button"\n [disabled]="!showDecMinute" class="dp-time-select-control-down"\n (click)="decrease(\'minute\')"></button>\n </li>\n <ng-container *ngIf="componentConfig.showSeconds">\n <li class="dp-time-select-control dp-time-select-separator"\n [innerText]="componentConfig.timeSeparator">\n </li>\n <li class="dp-time-select-control dp-time-select-control-seconds">\n <button type="button"\n class="dp-time-select-control-up"\n [disabled]="!showIncSecond"\n (click)="increase(\'second\')"></button>\n <span class="dp-time-select-display-seconds"\n [innerText]="seconds">\n </span>\n <button type="button"\n class="dp-time-select-control-down"\n [disabled]="!showDecSecond"\n (click)="decrease(\'second\')"></button>\n </li>\n </ng-container>\n <li class="dp-time-select-control dp-time-select-control-meridiem" *ngIf="!componentConfig.showTwentyFourHours">\n <button type="button"\n class="dp-time-select-control-up"\n [disabled]="!showToggleMeridiem"\n (click)="toggleMeridiem()"></button>\n <span class="dp-time-select-display-meridiem"\n [innerText]="meridiem">\n </span>\n <button type="button"\n class="dp-time-select-control-down"\n [disabled]="!showToggleMeridiem"\n (click)="toggleMeridiem()"></button>\n </li>\n</ul>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[C,{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return i}),multi:!0},{provide:n.NG_VALIDATORS,useExisting:t.forwardRef(function(){return i}),multi:!0}],styles:["dp-time-select{display:inline-block}dp-time-select .dp-time-select-controls{margin:0;padding:0;text-align:center;line-height:normal;background:#fff}dp-time-select .dp-time-select-control{display:inline-block;width:35px;margin:0 auto;vertical-align:middle;font-size:inherit;letter-spacing:1px}dp-time-select .dp-time-select-control-down,dp-time-select .dp-time-select-control-up{position:relative;display:block;width:24px;height:24px;margin:3px auto;cursor:pointer}dp-time-select .dp-time-select-control-down::before,dp-time-select .dp-time-select-control-up::before{position:relative;content:'';display:inline-block;height:8px;width:8px;vertical-align:baseline;border-style:solid;border-width:2px 2px 0 0}dp-time-select .dp-time-select-control-up::before{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);top:4px}dp-time-select .dp-time-select-control-down::before{-webkit-transform:rotate(135deg);transform:rotate(135deg)}dp-time-select .dp-time-select-separator{width:5px}dp-time-select.dp-material .dp-time-select-control-down,dp-time-select.dp-material .dp-time-select-control-up{box-sizing:border-box;background:0 0;border:none;outline:0;border-radius:50%}dp-time-select.dp-material .dp-time-select-control-down::before,dp-time-select.dp-material .dp-time-select-control-up::before{left:0}dp-time-select.dp-material .dp-time-select-control-down:hover,dp-time-select.dp-material .dp-time-select-control-up:hover{background:#e0e0e0}"]}),d("design:paramtypes",[C,u,t.ChangeDetectorRef])],e)}(),D=o,T=function(){function e(e,n,i){this.utilsService=e,this.timeSelectService=n,this.daytimeCalendarService=i,this.onPickerClosed=new t.EventEmitter,this.defaultConfig={closeOnSelect:!0,closeOnSelectDelay:100,format:"DD-MM-YYYY",openOnFocus:!0,openOnClick:!0,onOpenDelay:0,disableKeypress:!1,showNearMonthDays:!0,showWeekNumbers:!1,enableMonthSelector:!0,showGoToCurrent:!0,locale:D.locale(),hideOnOutsideClick:!0}}return e.prototype.getConfig=function(e,t){void 0===t&&(t="daytime");var n=c({},this.defaultConfig,{format:this.getDefaultFormatByMode(t)},this.utilsService.clearUndefined(e));return this.utilsService.convertPropsToMoment(n,n.format,["min","max"]),e&&e.allowMultiSelect&&e.closeOnSelect===undefined&&(n.closeOnSelect=!1),D.locale(n.locale),n},e.prototype.getDayConfigService=function(e){return{min:e.min,max:e.max,isDayDisabledCallback:e.isDayDisabledCallback,weekDayFormat:e.weekDayFormat,showNearMonthDays:e.showNearMonthDays,showWeekNumbers:e.showWeekNumbers,firstDayOfWeek:e.firstDayOfWeek,format:e.format,allowMultiSelect:e.allowMultiSelect,monthFormat:e.monthFormat,monthFormatter:e.monthFormatter,enableMonthSelector:e.enableMonthSelector,yearFormat:e.yearFormat,yearFormatter:e.yearFormatter,dayBtnFormat:e.dayBtnFormat,dayBtnFormatter:e.dayBtnFormatter,dayBtnCssClassCallback:e.dayBtnCssClassCallback,monthBtnFormat:e.monthBtnFormat,monthBtnFormatter:e.monthBtnFormatter,monthBtnCssClassCallback:e.monthBtnCssClassCallback,multipleYearsNavigateBy:e.multipleYearsNavigateBy,showMultipleYearsNavigation:e.showMultipleYearsNavigation,locale:e.locale,returnedValueType:e.returnedValueType,showGoToCurrent:e.showGoToCurrent,unSelectOnClick:e.unSelectOnClick}},e.prototype.getDayTimeConfigService=function(e){return this.daytimeCalendarService.getConfig(e)},e.prototype.getTimeConfigService=function(e){return this.timeSelectService.getConfig(e)},e.prototype.pickerClosed=function(){this.onPickerClosed.emit()},e.prototype.isValidInputDateValue=function(e,t){var n=this;return e=e||"",this.utilsService.datesStringToStringArray(e).every(function(e){return n.utilsService.isDateValid(e,t.format)})},e.prototype.convertInputValueToMomentArray=function(e,t){e=e||"";var n=this.utilsService.datesStringToStringArray(e);return this.utilsService.convertToMomentArray(n,t.format,t.allowMultiSelect)},e.prototype.getDefaultFormatByMode=function(e){switch(e){case"day":return"DD-MM-YYYY";case"daytime":return"DD-MM-YYYY HH:mm:ss";case"time":return"HH:mm:ss";case"month":return"MMM, YYYY"}},e=l([t.Injectable(),d("design:paramtypes",[u,C,S])],e)}(),E=o,x=function(){function e(e){this.utilsService=e,this.DEFAULT_CONFIG={allowMultiSelect:!1,yearFormat:"YYYY",format:"MM-YYYY",isNavHeaderBtnClickable:!1,monthBtnFormat:"MMM",locale:E.locale(),multipleYearsNavigateBy:10,showMultipleYearsNavigation:!1,unSelectOnClick:!0}}return e.prototype.getConfig=function(e){var t=c({},this.DEFAULT_CONFIG,this.utilsService.clearUndefined(e));return this.utilsService.convertPropsToMoment(t,t.format,["min","max"]),E.locale(t.locale),t},e.prototype.generateYear=function(e,t,n){var i=this;void 0===n&&(n=null);var o=t.clone().startOf("year");return this.utilsService.createArray(3).map(function(){return i.utilsService.createArray(4).map(function(){var t=o.clone(),r={date:t,selected:!!n.find(function(e){return o.isSame(e,"month")}),currentMonth:o.isSame(E(),"month"),disabled:i.isMonthDisabled(t,e),text:i.getMonthBtnText(e,t)};return o.add(1,"month"),r})})},e.prototype.isMonthDisabled=function(e,t){return!(!t.min||!e.isBefore(t.min,"month"))||!(!t.max||!e.isAfter(t.max,"month"))},e.prototype.shouldShowLeft=function(e,t){return!e||e.isBefore(t,"year")},e.prototype.shouldShowRight=function(e,t){return!e||e.isAfter(t,"year")},e.prototype.getHeaderLabel=function(e,t){return e.yearFormatter?e.yearFormatter(t):t.format(e.yearFormat)},e.prototype.getMonthBtnText=function(e,t){return e.monthBtnFormatter?e.monthBtnFormatter(t):t.format(e.monthBtnFormat)},e.prototype.getMonthBtnCssClass=function(e,t){return e.monthBtnCssClassCallback?e.monthBtnCssClassCallback(t):""},e=l([t.Injectable(),d("design:paramtypes",[u])],e)}(),O=o,M=function(){function e(e,n,i){this.monthCalendarService=e,this.utilsService=n,this.cd=i,this.onSelect=new t.EventEmitter,this.onNavHeaderBtnClick=new t.EventEmitter,this.onGoToCurrent=new t.EventEmitter,this.onLeftNav=new t.EventEmitter,this.onRightNav=new t.EventEmitter,this.onLeftSecondaryNav=new t.EventEmitter,this.onRightSecondaryNav=new t.EventEmitter,this.isInited=!1,this._shouldShowCurrent=!0,this.api={toggleCalendar:this.toggleCalendarMode.bind(this),moveCalendarTo:this.moveCalendarTo.bind(this)}}var i;return i=e,Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected},set:function(e){this._selected=e,this.onChangeCallback(this.processOnChangeCallback(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentDateView",{get:function(){return this._currentDateView},set:function(e){this._currentDateView=e.clone(),this.yearMonths=this.monthCalendarService.generateYear(this.componentConfig,this._currentDateView,this.selected),this.navLabel=this.monthCalendarService.getHeaderLabel(this.componentConfig,this.currentDateView),this.showLeftNav=this.monthCalendarService.shouldShowLeft(this.componentConfig.min,this._currentDateView),this.showRightNav=this.monthCalendarService.shouldShowRight(this.componentConfig.max,this.currentDateView),this.showSecondaryLeftNav=this.componentConfig.showMultipleYearsNavigation&&this.showLeftNav,this.showSecondaryRightNav=this.componentConfig.showMultipleYearsNavigation&&this.showRightNav},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.isInited=!0,this.init(),this.initValidators()},e.prototype.ngOnChanges=function(e){if(this.isInited){var t=e.minDate,n=e.maxDate,i=e.config;this.handleConfigChange(i),this.init(),(t||n)&&this.initValidators()}},e.prototype.init=function(){this.componentConfig=this.monthCalendarService.getConfig(this.config),this.selected=this.selected||[],this.currentDateView=this.displayDate?this.displayDate:this.utilsService.getDefaultDisplayDate(this.currentDateView,this.selected,this.componentConfig.allowMultiSelect,this.componentConfig.min),this.inputValueType=this.utilsService.getInputType(this.inputValue,this.componentConfig.allowMultiSelect),this._shouldShowCurrent=this.shouldShowCurrent()},e.prototype.writeValue=function(e){this.inputValue=e,e?(this.selected=this.utilsService.convertToMomentArray(e,this.componentConfig.format,this.componentConfig.allowMultiSelect),this.yearMonths=this.monthCalendarService.generateYear(this.componentConfig,this.currentDateView,this.selected),this.inputValueType=this.utilsService.getInputType(this.inputValue,this.componentConfig.allowMultiSelect)):(this.selected=[],this.yearMonths=this.monthCalendarService.generateYear(this.componentConfig,this.currentDateView,this.selected)),this.cd.markForCheck()},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.onChangeCallback=function(e){},e.prototype.registerOnTouched=function(e){},e.prototype.validate=function(e){return this.minDate||this.maxDate?this.validateFn(e.value):function(){return null}},e.prototype.processOnChangeCallback=function(e){return this.utilsService.convertFromMomentArray(this.componentConfig.format,e,this.componentConfig.returnedValueType||this.inputValueType)},e.prototype.initValidators=function(){this.validateFn=this.validateFn=this.utilsService.createValidator({minDate:this.minDate,maxDate:this.maxDate},this.componentConfig.format,"month"),this.onChangeCallback(this.processOnChangeCallback(this.selected))},e.prototype.monthClicked=function(e){e.selected&&!this.componentConfig.unSelectOnClick||(this.selected=this.utilsService.updateSelected(this.componentConfig.allowMultiSelect,this.selected,e,"month"),this.yearMonths=this.monthCalendarService.generateYear(this.componentConfig,this.currentDateView,this.selected),this.onSelect.emit(e))},e.prototype.onLeftNavClick=function(){var e=this.currentDateView.clone();this.currentDateView=this.currentDateView.clone().subtract(1,"year");var t=this.currentDateView.clone();this.yearMonths=this.monthCalendarService.generateYear(this.componentConfig,this.currentDateView,this.selected),this.onLeftNav.emit({from:e,to:t})},e.prototype.onLeftSecondaryNavClick=function(){var e=this.componentConfig.multipleYearsNavigateBy;this.componentConfig.min&&this.currentDateView.year()-this.componentConfig.min.year()<e&&(e=this.currentDateView.year()-this.componentConfig.min.year());var t=this.currentDateView.clone();this.currentDateView=this.currentDateView.clone().subtract(e,"year");var n=this.currentDateView.clone();this.onLeftSecondaryNav.emit({from:t,to:n})},e.prototype.onRightNavClick=function(){var e=this.currentDateView.clone();this.currentDateView=this.currentDateView.clone().add(1,"year");var t=this.currentDateView.clone();this.onRightNav.emit({from:e,to:t})},e.prototype.onRightSecondaryNavClick=function(){var e=this.componentConfig.multipleYearsNavigateBy;this.componentConfig.max&&this.componentConfig.max.year()-this.currentDateView.year()<e&&(e=this.componentConfig.max.year()-this.currentDateView.year());var t=this.currentDateView.clone();this.currentDateView=this.currentDateView.clone().add(e,"year");var n=this.currentDateView.clone();this.onRightSecondaryNav.emit({from:t,to:n})},e.prototype.toggleCalendarMode=function(){this.onNavHeaderBtnClick.emit()},e.prototype.getMonthBtnCssClass=function(e){var t={"dp-selected":e.selected,"dp-current-month":e.currentMonth},n=this.monthCalendarService.getMonthBtnCssClass(this.componentConfig,e.date);return n&&(t[n]=!0),t},e.prototype.shouldShowCurrent=function(){return this.utilsService.shouldShowCurrent(this.componentConfig.showGoToCurrent,"month",this.componentConfig.min,this.componentConfig.max)},e.prototype.goToCurrent=function(){this.currentDateView=O(),this.onGoToCurrent.emit()},e.prototype.moveCalendarTo=function(e){e&&(this.currentDateView=this.utilsService.convertToMoment(e,this.componentConfig.format),this.cd.markForCheck())},e.prototype.handleConfigChange=function(e){if(e){var t=this.monthCalendarService.getConfig(e.previousValue),n=this.monthCalendarService.getConfig(e.currentValue);this.utilsService.shouldResetCurrentView(t,n)&&(this._currentDateView=null)}},l([t.Input(),d("design:type",Object)],e.prototype,"config",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"displayDate",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"minDate",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"maxDate",void 0),l([t.HostBinding("class"),t.Input(),d("design:type",String)],e.prototype,"theme",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onSelect",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onNavHeaderBtnClick",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onGoToCurrent",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onLeftNav",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onRightNav",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onLeftSecondaryNav",void 0),l([t.Output(),d("design:type",t.EventEmitter)],e.prototype,"onRightSecondaryNav",void 0),e=i=l([t.Component({selector:"dp-month-calendar",template:'<div class="dp-month-calendar-container">\n <dp-calendar-nav\n [label]="navLabel"\n [showLeftNav]="showLeftNav"\n [showLeftSecondaryNav]="showSecondaryLeftNav"\n [showRightNav]="showRightNav"\n [showRightSecondaryNav]="showSecondaryRightNav"\n [isLabelClickable]="componentConfig.isNavHeaderBtnClickable"\n [showGoToCurrent]="shouldShowCurrent()"\n [theme]="theme"\n (onLeftNav)="onLeftNavClick()"\n (onLeftSecondaryNav)="onLeftSecondaryNavClick()"\n (onRightNav)="onRightNavClick()"\n (onRightSecondaryNav)="onRightSecondaryNavClick()"\n (onLabelClick)="toggleCalendarMode()"\n (onGoToCurrent)="goToCurrent()">\n </dp-calendar-nav>\n\n <div class="dp-calendar-wrapper">\n <div class="dp-months-row" *ngFor="let monthRow of yearMonths">\n <button type="button"\n class="dp-calendar-month"\n *ngFor="let month of monthRow"\n [attr.data-date]="month.date.format(componentConfig.format)"\n [disabled]="month.disabled"\n [ngClass]="getMonthBtnCssClass(month)"\n (click)="monthClicked(month)"\n [innerText]="month.text">\n </button>\n </div>\n </div>\n</div>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[x,{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return i}),multi:!0},{provide:n.NG_VALIDATORS,useExisting:t.forwardRef(function(){return i}),multi:!0}],styles:["dp-month-calendar{display:inline-block}dp-month-calendar .dp-month-calendar-container{background:#fff}dp-month-calendar .dp-calendar-wrapper{border:1px solid #000}dp-month-calendar .dp-calendar-month{box-sizing:border-box;width:52.5px;height:52.5px;cursor:pointer}dp-month-calendar .dp-calendar-month.dp-selected{background:#106cc8;color:#fff}dp-month-calendar.dp-material .dp-calendar-weekday{height:25px;width:30px;line-height:25px;background:#e0e0e0;border:1px solid #e0e0e0}dp-month-calendar.dp-material .dp-calendar-wrapper{border:1px solid #e0e0e0}dp-month-calendar.dp-material .dp-calendar-month{box-sizing:border-box;background:#fff;border-radius:50%;border:none;outline:0}dp-month-calendar.dp-material .dp-calendar-month:hover{background:#e0e0e0}dp-month-calendar.dp-material .dp-selected{background:#106cc8;color:#fff}dp-month-calendar.dp-material .dp-selected:hover{background:#106cc8}dp-month-calendar.dp-material .dp-current-month{border:1px solid #106cc8}"]}),d("design:paramtypes",[x,u,t.ChangeDetectorRef])],e)}(),N=function(){function e(e,n,i){this.dayTimeCalendarService=e,this.utilsService=n,this.cd=i,this.onChange=new t.EventEmitter,this.onGoToCurrent=new t.EventEmitter,this.onLeftNav=new t.EventEmitter,this.onRightNav=new t.EventEmitter,this.isInited=!1,this.api={moveCalendarTo:this.moveCalendarTo.bind(this)}}var i;return i=e,Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected},set:function(e){this._selected=e,this.onChangeCallback(this.processOnChangeCallback(e))},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.isInited=!0,this.init(),this.initValidators()},e.prototype.init=function(){this.componentConfig=this.dayTimeCalendarService.getConfig(this.config),this.inputValueType=this.utilsService.getInputType(this.inputValue,!1)},e.prototype.ngOnChanges=function(e){if(this.isInited){var t=e.minDate,n=e.maxDate;this.init(),(t||n)&&this.initValidators()}},e.prototype.writeValue=function(e){this.inputValue=e,e?(this.selected=this.utilsService.convertToMomentArray(e,this.componentConfig.format,!1)[0],this.inputValueType=this.utilsService.getInputType(this.inputValue,!1)):this.selected=null,this.cd.markForCheck()},e.prototype.registerOnChange=function(e){this.onChangeCallback=e},e.prototype.onChangeCallback=function(e){},e.prototype.registerOnTouched=function(e){},e.prototype.validate=function(e){return this.minDate||this.maxDate?this.validateFn(e.value):function(){return null}},e.prototype.processOnChangeCallback=function(e){return this.utilsService.convertFromMomentArray(this.componentConfig.format,[e],this.componentConfig.returnedValueType||this.inputValueType)},e.prototype.initValidators=function(){this.validateFn=this.utilsService.createValidator({minDate:this.minDate,maxDate:this.maxDate},undefined,"daytime"),this.onChangeCallback(this.processOnChangeCallback(this.selected))},e.prototype.dateSelected=function(e){this.selected=this.dayTimeCalendarService.updateDay(this.selected,e.date,this.config),this.emitChange()},e.prototype.timeChange=function(e){this.selected=this.dayTimeCalendarService.updateTime(this.selected,e.date),this.emitChange()},e.prototype.emitChange=function(){this.onChange.emit({date:this.selected,selected:!1})},e.prototype.moveCalendarTo=function(e){e&&this.dayCalendarRef.moveCalendarTo(e)},e.prototype.onLeftNavClick=function(e){this.onLeftNav.emit(e)},e.prototype.onRightNavClick=function(e){this.onRightNav.emit(e)},l([t.Input(),d("design:type",Object)],e.prototype,"config",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"displayDate",void 0),l([t.Input(),d("design:type",Object)],e.prototype,"minD