UNPKG

angular-weblineindia-date-picker

Version:

Date Picker component built in AngularJS to select date and time. Supports Angular 9 version.

15 lines (13 loc) 81.3 kB
!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.moment)}(this,(function(e,t,n,i,o){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */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}(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 d=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.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new e},token:e,providedIn:"root"}),e=n=l([t.Injectable({providedIn:"root"})],e)}(),p=o,h=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?p(e,t):e.clone():null},n.prototype.isDateValid=function(e,t){return""===e||p(e,t,!0).isValid()},n.prototype.getDefaultDisplayDate=function(e,t,n,i){if(e)return e.clone();if(i&&i.isAfter(p()))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 p()},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(p.isMoment(t[0]))return e.ECalendarValue.MomentArr}else{if("string"==typeof t)return e.ECalendarValue.String;if(p.isMoment(t))return e.ECalendarValue.Moment}return n?e.ECalendarValue.MomentArr:e.ECalendarValue.Moment},n.prototype.convertToMomentArray=function(t,n){var i;switch(this.getInputType(t,n.allowMultiSelect)){case e.ECalendarValue.String:i=t?[p(t,n.format,!0)]:[];break;case e.ECalendarValue.StringArr:i=t.map((function(e){return e?p(e,n.format,!0):null})).filter(Boolean);break;case e.ECalendarValue.Moment:i=t?[t.clone()]:[];break;case e.ECalendarValue.MomentArr:i=(t||[]).map((function(e){return e.clone()}));break;default:i=[]}return i},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(!p.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 void 0===e[t]&&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){if(e)return e.querySelector(t)||this.closestParent(e.parentElement,t)},n.prototype.onlyTime=function(e){return e&&p.isMoment(e)&&p(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,{format:t,allowMultiSelect:!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 p(e,t)}))},n.prototype.shouldShowCurrent=function(e,t,n,i){return e&&"time"!==t&&this.isDateInRange(p(),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.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new n},token:n,providedIn:"root"}),n=l([t.Injectable({providedIn:"root"})],n)}(),u=o,m=function(){function e(e){this.utilsService=e,this.DEFAULT_CONFIG={showNearMonthDays:!0,showWeekNumbers:!1,firstDayOfWeek:"su",weekDayFormat:"ddd",format:"DD-MM-YYYY",allowMultiSelect:!1,monthFormat:"MMM, YYYY",enableMonthSelector:!0,locale:u.locale(),dayBtnFormat:"DD",unSelectOnClick:!0},this.DAYS=["su","mo","tu","we","th","fr","sa"]}return e.prototype.getConfig=function(e){var t=c(c({},this.DEFAULT_CONFIG),this.utilsService.clearUndefined(e));return this.utilsService.convertPropsToMoment(t,t.format,["min","max"]),u.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=u();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:u().day(0),mo:u().day(1),tu:u().day(2),we:u().day(3),th:u().day(4),fr:u().day(5),sa:u().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,locale:e.locale,yearFormat:e.yearFormat,yearFormatter:e.yearFormatter,monthBtnFormat:e.monthBtnFormat,monthBtnFormatter:e.monthBtnFormatter,monthBtnCssClassCallback:e.monthBtnCssClassCallback,multipleYearsNavigateBy:e.multipleYearsNavigateBy,showMultipleYearsNavigation:e.showMultipleYearsNavigation,showGoToCurrent:e.showGoToCurrent,numOfMonthRows:e.numOfMonthRows})},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.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.ctorParameters=function(){return[{type:h}]},e=l([t.Injectable()],e)}(),f=o,y=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:f.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(c(c({},this.DEFAULT_CONFIG),this.utilsService.clearUndefined(e)),t);return f.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||f();return n&&n.format(e.showTwentyFourHours?e.hours24Format:e.hours12Format)},e.prototype.getMinutes=function(e,t){var n=t||f();return n&&n.format(e.minutesFormat)},e.prototype.getSeconds=function(e,t){var n=t||f();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.ctorParameters=function(){return[{type:h}]},e=l([t.Injectable()],e)}(),v=o,g=function(){function e(e,t,n){this.utilsService=e,this.dayCalendarService=t,this.timeSelectService=n,this.DEFAULT_CONFIG={locale:v.locale()}}return e.prototype.getConfig=function(e){var t=c(c(c({},this.DEFAULT_CONFIG),this.timeSelectService.getConfig(e)),this.dayCalendarService.getConfig(e));return v.locale(e.locale),t},e.prototype.updateDay=function(e,t,n){var i=e||v(),o=v(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||v();return v(n.format("YYYYMMDD")+t.format("HH:mm:ss"),"YYYYMMDDHH:mm:ss")},e.ctorParameters=function(){return[{type:h},{type:m},{type:y}]},e=l([t.Injectable()],e)}(),C=o,b=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,closeOnEnter:!0,format:"DD-MM-YYYY",openOnFocus:!0,openOnClick:!0,onOpenDelay:0,disableKeypress:!1,showNearMonthDays:!0,showWeekNumbers:!1,enableMonthSelector:!0,showGoToCurrent:!0,locale:C.locale(),hideOnOutsideClick:!0}}return e.prototype.getConfig=function(e,t){void 0===t&&(t="daytime");var n=c(c(c({},this.defaultConfig),{format:this.getDefaultFormatByMode(t)}),this.utilsService.clearUndefined(e));return this.utilsService.convertPropsToMoment(n,n.format,["min","max"]),e&&e.allowMultiSelect&&void 0===e.closeOnSelect&&(n.closeOnSelect=!1),C.locale(n.locale),n},e.prototype.getDayConfigService=function(e){return{min:e.min,max:e.max,isDayDisabledCallback:e.isDayDisabledCallback,weekDayFormat:e.weekDayFormat,weekDayFormatter:e.weekDayFormatter,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,numOfMonthRows:e.numOfMonthRows}},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)},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.ctorParameters=function(){return[{type:h},{type:y},{type:g}]},e=l([t.Injectable()],e)}(),S=function(){function i(n,i,o,r,a,s){this.dayPickerService=n,this.domHelper=i,this.elemRef=o,this.renderer=r,this.utilsService=a,this.cd=s,this.isInitialized=!1,this.mode="day",this.placeholder="",this.disabled=!1,this.open=new t.EventEmitter,this.close=new t.EventEmitter,this.onChange=new t.EventEmitter,this.onGoToCurrent=new t.EventEmitter,this.onLeftNav=new t.EventEmitter,this.onRightNav=new t.EventEmitter,this.onSelect=new t.EventEmitter,this.hideStateHelper=!1,this.isFocusedTrigger=!1,this.handleInnerElementClickUnlisteners=[],this.globalListenersUnlisteners=[],this.api={open:this.showCalendars.bind(this),close:this.hideCalendar.bind(this),moveCalendarTo:this.moveCalendarTo.bind(this)},this.selectEvent=e.SelectEvent,this._areCalendarsShown=!1,this._selected=[]}var o;return o=i,Object.defineProperty(i.prototype,"openOnFocus",{get:function(){return this.componentConfig.openOnFocus},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"openOnClick",{get:function(){return this.componentConfig.openOnClick},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"areCalendarsShown",{get:function(){return this._areCalendarsShown},set:function(e){e?(this.startGlobalListeners(),this.domHelper.appendElementToPosition({container:this.appendToElement,element:this.calendarWrapper,anchor:this.inputElementContainer,dimElem:this.popupElem,drops:this.componentConfig.drops,opens:this.componentConfig.opens})):(this.stopGlobalListeners(),this.dayPickerService.pickerClosed()),this._areCalendarsShown=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selected",{get:function(){return this._selected},set:function(t){this._selected=t,this.inputElementValue=this.utilsService.convertFromMomentArray(this.componentConfig.format,t,e.ECalendarValue.StringArr).join(" | ");var n=this.processOnChangeCallback(t);this.onChangeCallback(n,!1),this.onChange.emit(n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentDateView",{get:function(){return this._currentDateView},set:function(e){this._currentDateView=e,this.dayCalendarRef&&this.dayCalendarRef.moveCalendarTo(e),this.monthCalendarRef&&this.monthCalendarRef.moveCalendarTo(e),this.dayTimeCalendarRef&&this.dayTimeCalendarRef.moveCalendarTo(e)},enumerable:!0,configurable:!0}),i.prototype.onClick=function(){this.openOnClick&&(this.isFocusedTrigger||this.disabled||(this.hideStateHelper=!0,this.areCalendarsShown||this.showCalendars()))},i.prototype.onBodyClick=function(){this.componentConfig.hideOnOutsideClick&&(!this.hideStateHelper&&this.areCalendarsShown&&this.hideCalendar(),this.hideStateHelper=!1)},i.prototype.onScroll=function(){this.areCalendarsShown&&this.domHelper.setElementPosition({container:this.appendToElement,element:this.calendarWrapper,anchor:this.inputElementContainer,dimElem:this.popupElem,drops:this.componentConfig.drops,opens:this.componentConfig.opens})},i.prototype.writeValue=function(e){this.inputValue=e,e||""===e?(this.selected=this.utilsService.convertToMomentArray(e,this.componentConfig),this.init()):this.selected=[],this.cd.markForCheck()},i.prototype.registerOnChange=function(e){this.onChangeCallback=e},i.prototype.onChangeCallback=function(e,t){},i.prototype.registerOnTouched=function(e){this.onTouchedCallback=e},i.prototype.onTouchedCallback=function(){},i.prototype.validate=function(e){return this.validateFn(e.value)},i.prototype.processOnChangeCallback=function(e){return"string"==typeof e?e:this.utilsService.convertFromMomentArray(this.componentConfig.format,e,this.componentConfig.returnedValueType||this.utilsService.getInputType(this.inputValue,this.componentConfig.allowMultiSelect))},i.prototype.initValidators=function(){this.validateFn=this.utilsService.createValidator({minDate:this.minDate,maxDate:this.maxDate,minTime:this.minTime,maxTime:this.maxTime},this.componentConfig.format,this.mode),this.onChangeCallback(this.processOnChangeCallback(this.selected),!1)},i.prototype.ngOnInit=function(){this.isInitialized=!0,this.init()},i.prototype.ngOnChanges=function(e){this.isInitialized&&this.init()},i.prototype.ngAfterViewInit=function(){this.setElementPositionInDom()},i.prototype.setDisabledState=function(e){this.disabled=e,this.cd.markForCheck()},i.prototype.setElementPositionInDom=function(){this.calendarWrapper=this.calendarContainer.nativeElement,this.setInputElementContainer(),this.popupElem=this.elemRef.nativeElement.querySelector(".dp-popup"),this.handleInnerElementClick(this.popupElem);var e=this.componentConfig.appendTo;this.appendToElement=e?"string"==typeof e?document.querySelector(e):e:this.elemRef.nativeElement,this.appendToElement.appendChild(this.calendarWrapper)},i.prototype.setInputElementContainer=function(){this.inputElementContainer=this.utilsService.getNativeElement(this.componentConfig.inputElementContainer)||this.elemRef.nativeElement.querySelector(".dp-input-container")||document.body},i.prototype.handleInnerElementClick=function(e){var t=this;this.handleInnerElementClickUnlisteners.push(this.renderer.listen(e,"click",(function(){t.hideStateHelper=!0})))},i.prototype.init=function(){this.componentConfig=this.dayPickerService.getConfig(this.config,this.mode),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.dayCalendarConfig=this.dayPickerService.getDayConfigService(this.componentConfig),this.dayTimeCalendarConfig=this.dayPickerService.getDayTimeConfigService(this.componentConfig),this.timeSelectConfig=this.dayPickerService.getTimeConfigService(this.componentConfig),this.initValidators()},i.prototype.inputFocused=function(){var e=this;this.openOnFocus&&(clearTimeout(this.onOpenDelayTimeoutHandler),this.isFocusedTrigger=!0,this.onOpenDelayTimeoutHandler=setTimeout((function(){e.areCalendarsShown||e.showCalendars(),e.hideStateHelper=!1,e.isFocusedTrigger=!1,e.cd.markForCheck()}),this.componentConfig.onOpenDelay))},i.prototype.inputBlurred=function(){clearTimeout(this.onOpenDelayTimeoutHandler),this.onTouchedCallback()},i.prototype.showCalendars=function(){this.hideStateHelper=!0,this.areCalendarsShown=!0,this.timeSelectRef&&this.timeSelectRef.api.triggerChange(),this.open.emit(),this.cd.markForCheck()},i.prototype.hideCalendar=function(){this.areCalendarsShown=!1,this.dayCalendarRef&&this.dayCalendarRef.api.toggleCalendarMode(e.ECalendarMode.Day),this.close.emit(),this.cd.markForCheck()},i.prototype.onViewDateChange=function(t){var n=t?this.utilsService.convertToString(t,this.componentConfig.format):"";this.dayPickerService.isValidInputDateValue(n,this.componentConfig)?(this.selected=this.dayPickerService.convertInputValueToMomentArray(n,this.componentConfig),this.currentDateView=this.selected.length?this.utilsService.getDefaultDisplayDate(null,this.selected,this.componentConfig.allowMultiSelect,this.componentConfig.min):this.currentDateView,this.onSelect.emit({date:n,type:e.SelectEvent.INPUT,granularity:null})):(this._selected=this.utilsService.getValidMomentArray(n,this.componentConfig.format),this.onChangeCallback(this.processOnChangeCallback(n),!0))},i.prototype.dateSelected=function(e,t,n,i){this.selected=this.utilsService.updateSelected(this.componentConfig.allowMultiSelect,this.selected,e,t),i||this.onDateClick(),this.onSelect.emit({date:e.date,granularity:t,type:n})},i.prototype.onDateClick=function(){this.componentConfig.closeOnSelect&&setTimeout(this.hideCalendar.bind(this),this.componentConfig.closeOnSelectDelay)},i.prototype.onKeyPress=function(e){switch(e.keyCode){case 9:case 27:this.hideCalendar()}},i.prototype.moveCalendarTo=function(e){var t=this.utilsService.convertToMoment(e,this.componentConfig.format);this.currentDateView=t},i.prototype.onLeftNavClick=function(e){this.onLeftNav.emit(e)},i.prototype.onRightNavClick=function(e){this.onRightNav.emit(e)},i.prototype.startGlobalListeners=function(){var e=this;this.globalListenersUnlisteners.push(this.renderer.listen(document,"keydown",(function(t){e.onKeyPress(t)})),this.renderer.listen(document,"scroll",(function(){e.onScroll()})),this.renderer.listen(document,"click",(function(){e.onBodyClick()})))},i.prototype.stopGlobalListeners=function(){this.globalListenersUnlisteners.forEach((function(e){return e()})),this.globalListenersUnlisteners=[]},i.prototype.ngOnDestroy=function(){this.handleInnerElementClickUnlisteners.forEach((function(e){return e()})),this.appendToElement&&this.appendToElement.removeChild(this.calendarWrapper)},i.ctorParameters=function(){return[{type:b},{type:d},{type:t.ElementRef},{type:t.Renderer2},{type:h},{type:t.ChangeDetectorRef}]},l([t.Input()],i.prototype,"config",void 0),l([t.Input()],i.prototype,"mode",void 0),l([t.Input()],i.prototype,"placeholder",void 0),l([t.Input()],i.prototype,"disabled",void 0),l([t.Input()],i.prototype,"displayDate",void 0),l([t.HostBinding("class"),t.Input()],i.prototype,"theme",void 0),l([t.Input()],i.prototype,"minDate",void 0),l([t.Input()],i.prototype,"maxDate",void 0),l([t.Input()],i.prototype,"minTime",void 0),l([t.Input()],i.prototype,"maxTime",void 0),l([t.Output()],i.prototype,"open",void 0),l([t.Output()],i.prototype,"close",void 0),l([t.Output()],i.prototype,"onChange",void 0),l([t.Output()],i.prototype,"onGoToCurrent",void 0),l([t.Output()],i.prototype,"onLeftNav",void 0),l([t.Output()],i.prototype,"onRightNav",void 0),l([t.Output()],i.prototype,"onSelect",void 0),l([t.ViewChild("container")],i.prototype,"calendarContainer",void 0),l([t.ViewChild("dayCalendar")],i.prototype,"dayCalendarRef",void 0),l([t.ViewChild("monthCalendar")],i.prototype,"monthCalendarRef",void 0),l([t.ViewChild("daytimeCalendar")],i.prototype,"dayTimeCalendarRef",void 0),l([t.ViewChild("timeSelect")],i.prototype,"timeSelectRef",void 0),l([t.HostListener("click")],i.prototype,"onClick",null),l([t.HostListener("window:resize")],i.prototype,"onScroll",null),i=o=l([t.Component({selector:"dp-date-picker",template:'<div [ngClass]="{\'dp-open\': areCalendarsShown}">\n <div [attr.data-hidden]="componentConfig.hideInputContainer"\n [hidden]="componentConfig.hideInputContainer"\n class="dp-input-container">\n <input (blur)="inputBlurred()"\n (focus)="inputFocused()"\n (ngModelChange)="onViewDateChange($event)"\n (keydown.enter)="componentConfig.closeOnEnter && hideCalendar()"\n [disabled]="disabled"\n [ngModel]="inputElementValue"\n [placeholder]="placeholder"\n [readonly]="componentConfig.disableKeypress"\n class="dp-picker-input"\n type="text"/>\n </div>\n <div #container>\n <div [attr.data-hidden]="!_areCalendarsShown"\n [hidden]="!_areCalendarsShown"\n [ngSwitch]="mode"\n class="dp-popup {{theme}}">\n <dp-day-calendar #dayCalendar\n (onGoToCurrent)="onGoToCurrent.emit()"\n (onLeftNav)="onLeftNavClick($event)"\n (onRightNav)="onRightNavClick($event)"\n (onSelect)="dateSelected($event, \'day\', selectEvent.SELECTION, false)"\n *ngSwitchCase="\'day\'"\n [config]="dayCalendarConfig"\n [displayDate]="displayDate"\n [ngModel]="_selected"\n [theme]="theme">\n </dp-day-calendar>\n\n <dp-month-calendar #monthCalendar\n (onGoToCurrent)="onGoToCurrent.emit()"\n (onLeftNav)="onLeftNavClick($event)"\n (onRightNav)="onRightNavClick($event)"\n (onSelect)="dateSelected($event, \'month\', selectEvent.SELECTION, false)"\n *ngSwitchCase="\'month\'"\n [config]="dayCalendarConfig"\n [displayDate]="displayDate"\n [ngModel]="_selected"\n [theme]="theme">\n </dp-month-calendar>\n\n <dp-time-select #timeSelect\n (onChange)="dateSelected($event, \'second\', selectEvent.SELECTION, true)"\n *ngSwitchCase="\'time\'"\n [config]="timeSelectConfig"\n [ngModel]="_selected && _selected[0]"\n [theme]="theme">\n </dp-time-select>\n\n <dp-day-time-calendar #daytimeCalendar\n (onChange)="dateSelected($event, \'second\', selectEvent.SELECTION, true)"\n (onGoToCurrent)="onGoToCurrent.emit()"\n (onLeftNav)="onLeftNavClick($event)"\n (onRightNav)="onRightNavClick($event)"\n *ngSwitchCase="\'daytime\'"\n [config]="dayTimeCalendarConfig"\n [displayDate]="displayDate"\n [ngModel]="_selected && _selected[0]"\n [theme]="theme">\n </dp-day-time-calendar>\n </div>\n </div>\n</div>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[b,g,m,y,{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-date-picker{display:inline-block}dp-date-picker.dp-material .dp-picker-input{box-sizing:border-box;height:30px;width:213px;font-size:13px;outline:0}dp-date-picker .dp-input-container{position:relative}dp-date-picker .dp-selected{background:#106cc8;color:#fff}.dp-popup{position:relative;background:#fff;box-shadow:1px 1px 5px 0 rgba(0,0,0,.1);border-left:1px solid rgba(0,0,0,.1);border-right:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(0,0,0,.1);z-index:9999;white-space:nowrap}"]})],i)}(),w=function(){function e(e){this.utilsService=e}return e.prototype.convertToHTMLElement=function(e,t){return"string"==typeof e?this.utilsService.closestParent(t,e):e?e.nativeElement:void 0},e.prototype.getConfig=function(e,t,n){void 0===e&&(e={});var i,o=c({},e);return o.hideInputContainer=!0,(i=e.inputElementContainer?this.utilsService.getNativeElement(e.inputElementContainer):t?t.nativeElement:null)&&(o.inputElementContainer=n?this.convertToHTMLElement(n,i):i),o},e.ctorParameters=function(){return[{type:h}]},e=l([t.Injectable()],e)}(),k=function(){function e(e,n,i,o,r,a){this.viewContainerRef=e,this.elemRef=n,this.componentFactoryResolver=i,this.service=o,this.formControl=r,this.utilsService=a,this.open=new t.EventEmitter,this.close=new t.EventEmitter,this.onChange=new t.EventEmitter,this.onGoToCurrent=new t.EventEmitter,this.onLeftNav=new t.EventEmitter,this.onRightNav=new t.EventEmitter,this.onSelect=new t.EventEmitter,this._mode="day"}var i,o;return Object.defineProperty(e.prototype,"config",{get:function(){return this._config},set:function(e){this._config=this.service.getConfig(e,this.viewContainerRef.element,this.attachTo),this.updateDatepickerConfig(),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"attachTo",{get:function(){return this._attachTo},set:function(e){this._attachTo=e,this._config=this.service.getConfig(this.config,this.viewContainerRef.element,this.attachTo),this.updateDatepickerConfig(),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"theme",{get:function(){return this._theme},set:function(e){this._theme=e,this.datePicker&&(this.datePicker.theme=e),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e,this.datePicker&&(this.datePicker.mode=e),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDate",{get:function(){return this._minDate},set:function(e){this._minDate=e,this.datePicker&&(this.datePicker.minDate=e,this.datePicker.ngOnInit()),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{get:function(){return this._maxDate},set:function(e){this._maxDate=e,this.datePicker&&(this.datePicker.maxDate=e,this.datePicker.ngOnInit()),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minTime",{get:function(){return this._minTime},set:function(e){this._minTime=e,this.datePicker&&(this.datePicker.minTime=e,this.datePicker.ngOnInit()),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxTime",{get:function(){return this._maxTime},set:function(e){this._maxTime=e,this.datePicker&&(this.datePicker.maxTime=e,this.datePicker.ngOnInit()),this.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayDate",{get:function(){return this._displayDate},set:function(e){this._displayDate=e,this.updateDatepickerConfig(),this.markForCheck()},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.datePicker=this.createDatePicker(),this.api=this.datePicker.api,this.updateDatepickerConfig(),this.attachModelToDatePicker(),this.datePicker.theme=this.theme},e.prototype.createDatePicker=function(){var e=this.componentFactoryResolver.resolveComponentFactory(S);return this.viewContainerRef.createComponent(e).instance},e.prototype.attachModelToDatePicker=function(){var e=this;if(this.formControl){this.datePicker.onViewDateChange(this.formControl.value),this.formControl.valueChanges.subscribe((function(t){if(t!==e.datePicker.inputElementValue){var n=e.utilsService.convertToString(t,e.datePicker.componentConfig.format);e.datePicker.onViewDateChange(n)}}));var t=!0;this.datePicker.registerOnChange((function(n,i){n&&(t&&Array.isArray(n)&&!n.length||i||e.formControl.control.setValue(e.datePicker.inputElementValue));var o=e.datePicker.validateFn(n);if(t?t=!1:e.formControl.control.markAsDirty({onlySelf:!0}),o){if(o.hasOwnProperty("format")){var r=o.format.given;e.datePicker.inputElementValue=r,i||e.formControl.control.setValue(r)}e.formControl.control.setErrors(o)}}))}},e.prototype.onClick=function(){this.datePicker.onClick()},e.prototype.onFocus=function(){this.datePicker.inputFocused()},e.prototype.onEnter=function(){this.datePicker.componentConfig.closeOnEnter&&this.datePicker.hideCalendar()},e.prototype.markForCheck=function(){this.datePicker&&this.datePicker.cd.markForCheck()},e.prototype.updateDatepickerConfig=function(){this.datePicker&&(this.datePicker.minDate=this.minDate,this.datePicker.maxDate=this.maxDate,this.datePicker.minTime=this.minTime,this.datePicker.maxTime=this.maxTime,this.datePicker.mode=this.mode||"day",this.datePicker.displayDate=this.displayDate,this.datePicker.config=this.config,this.datePicker.open=this.open,this.datePicker.close=this.close,this.datePicker.onChange=this.onChange,this.datePicker.onGoToCurrent=this.onGoToCurrent,this.datePicker.onLeftNav=this.onLeftNav,this.datePicker.onRightNav=this.onRightNav,this.datePicker.onSelect=this.onSelect,this.datePicker.init(),this.datePicker.componentConfig.disableKeypress?this.elemRef.nativeElement.setAttribute("readonly",!0):this.elemRef.nativeElement.removeAttribute("readonly"))},e.ctorParameters=function(){return[{type:t.ViewContainerRef},{type:t.ElementRef},{type:t.ComponentFactoryResolver},{type:w},{type:n.NgControl,decorators:[{type:t.Optional}]},{type:h}]},l([t.Input("dpDayPicker")],e.prototype,"config",null),l([t.Input()],e.prototype,"attachTo",null),l([t.Input()],e.prototype,"theme",null),l([t.Input()],e.prototype,"mode",null),l([t.Input()],e.prototype,"minDate",null),l([t.Input()],e.prototype,"maxDate",null),l([t.Input()],e.prototype,"minTime",null),l([t.Input()],e.prototype,"maxTime",null),l([t.Input()],e.prototype,"displayDate",null),l([t.Output()],e.prototype,"open",void 0),l([t.Output()],e.prototype,"close",void 0),l([t.Output()],e.prototype,"onChange",void 0),l([t.Output()],e.prototype,"onGoToCurrent",void 0),l([t.Output()],e.prototype,"onLeftNav",void 0),l([t.Output()],e.prototype,"onRightNav",void 0),l([t.Output()],e.prototype,"onSelect",void 0),l([t.HostListener("click")],e.prototype,"onClick",null),l([t.HostListener("focus")],e.prototype,"onFocus",null),l([t.HostListener("keydown.enter")],e.prototype,"onEnter",null),e=l([t.Directive({exportAs:"dpDayPicker",providers:[w],selector:"[dpDayPicker]"}),(i=4,o=t.Optional(),function(e,t){o(e,t,i)})],e)}(),D=o,T=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),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=D(),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),t.locale!==n.locale&&(this.currentDateView&&this.currentDateView.locale(n.locale),this.selected.forEach((function(e){return e.locale(n.locale)})))}},i.ctorParameters=function(){return[{type:m},{type:h},{type:t.ChangeDetectorRef}]},l([t.Input()],i.prototype,"config",void 0),l([t.Input()],i.prototype,"displayDate",void 0),l([t.Input()],i.prototype,"minDate",void 0),l([t.Input()],i.prototype,"maxDate",void 0),l([t.HostBinding("class"),t.Input()],i.prototype,"theme",void 0),l([t.Output()],i.prototype,"onSelect",void 0),l([t.Output()],i.prototype,"onMonthSelect",void 0),l([t.Output()],i.prototype,"onNavHeaderBtnClick",void 0),l([t.Output()],i.prototype,"onGoToCurrent",void 0),l([t.Output()],i.prototype,"onLeftNav",void 0),l([t.Output()],i.prototype,"onRightNav",void 0),i=o=l([t.Component({selector:"dp-day-calendar",template:'<div *ngIf="currentCalendarMode === CalendarMode.Day" class="dp-day-calendar-container">\n <dp-calendar-nav\n (onGoToCurrent)="goToCurrent()"\n (onLabelClick)="toggleCalendarMode(CalendarMode.Month)"\n (onLeftNav)="onLeftNavClick()"\n (onRightNav)="onRightNavClick()"\n [isLabelClickable]="componentConfig.enableMonthSelector"\n [label]="navLabel"\n [showGoToCurrent]="_shouldShowCurrent"\n [showLeftNav]="showLeftNav"\n [showRightNav]="showRightNav"\n [theme]="theme">\n </dp-calendar-nav>\n\n <div [ngClass]="{\'dp-hide-near-month\': !componentConfig.showNearMonthDays}"\n class="dp-calendar-wrapper">\n <div class="dp-weekdays">\n <span *ngFor="let weekday of weekdays"\n [innerText]="getWeekdayName(weekday)"\n class="dp-calendar-weekday">\n </span>\n </div>\n <div *ngFor="let week of weeks" class="dp-calendar-week">\n <span *ngIf="componentConfig.showWeekNumbers"\n [innerText]="week[0].date.isoWeek()"\n class="dp-week-number">\n </span>\n <button (click)="dayClicked(day)"\n *ngFor="let day of week"\n [attr.data-date]="day.date.format(componentConfig.format)"\n [disabled]="day.disabled"\n [innerText]="getDayBtnText(day)"\n [ngClass]="getDayBtnCssClass(day)"\n class="dp-calendar-day"\n type="button">\n </button>\n </div>\n </div>\n</div>\n\n<dp-month-calendar\n (onLeftNav)="onMonthCalendarLeftClick($event)"\n (onLeftSecondaryNav)="onMonthCalendarSecondaryLeftClick($event)"\n (onNavHeaderBtnClick)="toggleCalendarMode(CalendarMode.Day)"\n (onRightNav)="onMonthCalendarRightClick($event)"\n (onRightSecondaryNav)="onMonthCalendarSecondaryRightClick($event)"\n (onSelect)="monthSelected($event)"\n *ngIf="currentCalendarMode === CalendarMode.Month"\n [config]="monthCalendarConfig"\n [displayDate]="_currentDateView"\n [ngModel]="_selected"\n [theme]="theme">\n</dp-month-calendar>\n',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[m,{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}"]})],i)}(),x=o,M=function(){function e(e){this.utilsService=e,this.DEFAULT_CONFIG={allowMultiSelect:!1,yearFormat:"YYYY",format:"MM-YYYY",isNavHeaderBtnClickable:!1,monthBtnFormat:"MMM",locale:x.locale(),multipleYearsNavigateBy:10,showMultipleYearsNavigation:!1,unSelectOnClick:!0,numOfMonthRows:3}}return e.prototype.getConfig=function(e){var t=c(c({},this.DEFAULT_CONFIG),this.utilsService.clearUndefined(e));return this.validateConfig(t),this.utilsService.convertPropsToMoment(t,t.format,["min","max"]),x.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(e.numOfMonthRows).map((function(){return i.utilsService.createArray(12/e.numOfMonthRows).map((funct