UNPKG

@duoduo-oba/ng-devui

Version:

DevUI components based on Angular

15 lines (13 loc) 115 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/forms"),require("ng-devui/utils"),require("ng-devui/i18n"),require("@angular/animations"),require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("@angular/cdk/overlay"),require("ng-devui/button")):"function"==typeof define&&define.amd?define("ng-devui/datepicker",["exports","@angular/core","@angular/forms","ng-devui/utils","ng-devui/i18n","@angular/animations","rxjs","rxjs/operators","@angular/common","@angular/cdk/overlay","ng-devui/button"],t):t(((e=e||self)["ng-devui"]=e["ng-devui"]||{},e["ng-devui"].datepicker={}),e.ng.core,e.ng.forms,e["ng-devui"].utils,e["ng-devui"].i18n,e.ng.animations,e.rxjs,e.rxjs.operators,e.ng.common,e.ng.cdk.overlay,e["ng-devui"].button)}(this,(function(e,t,n,i,r,a,o,s,d,l,c){"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 h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function u(e,t){function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function p(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=a.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}var g=function(){function e(){this.dateConfig={timePicker:!1,dateConverter:null,min:1900,max:2099,format:{date:"y/MM/dd",time:"y/MM/dd HH:mm:ss"}}}return e.decorators=[{type:t.Injectable}],e}();var m={date:0,time:1,button:2,format:3};m[m.date]="date",m[m.time]="time",m[m.button]="button",m[m.format]="format";var f=function(){function e(e,n,r,a,o){var s=this;this.elementRef=e,this.renderer2=n,this.datePickerConfig=r,this.changeDetectorRef=a,this.i18n=o,this.selectedDateChange=new t.EventEmitter,this.disabled=!1,this.yearNumber=12,this.onChange=function(e){return null},this.onTouched=function(){return null},this.clearAll=function(){s.writeValue(null),s.onChange(null),s.selectedDateChange.emit({reason:m.button,selectedDate:null})},this.chooseDate=function(e,t){void 0===t&&(t={});var n=s.dateConverter.parse(e,s.dateFormat,s.locale||s.i18nLocale);s.selectedDate=n||new Date,s.onSelectDateChanged(),s.onSelectDate(t,n)},this._dateConfig=r.dateConfig,this.dateConverter=r.dateConfig.dateConverter||new i.DefaultDateConverter,this.renderer2.setStyle(this.elementRef.nativeElement,"display","inline-block")}return e.prototype.ngOnInit=function(){var e=this;this.showTime=this.showTime||this.dateConfig.timePicker,this._minDate=this.minDate?new Date(this.minDate):new Date(this.dateConfig.min,0,1,0,0,0),this._maxDate=this.maxDate?new Date(this.maxDate):new Date(this.dateConfig.max,11,31,23,59,59),this.hourOptions=new Array(24).fill(0).map((function(t,n){return e.fillLeft(n)})),this.minuteOptions=new Array(60).fill(0).map((function(t,n){return e.fillLeft(n)})),this.nowMinYear=(new Date).getFullYear()-Math.floor(this.yearNumber/2)<this.minDate.getFullYear()?this.minDate.getFullYear():(new Date).getFullYear()-Math.floor(this.yearNumber/2),this.nowMaxYear=this.nowMinYear+this.yearNumber>this.maxDate.getFullYear()?this.maxDate.getFullYear():this.nowMinYear+this.yearNumber,this.setI18nText(),this.onSelectDateChanged(),this.onDisplayWeeksChange(),this.onYearRangeChange(),this.initDatePicker()},e.prototype.ngOnChanges=function(e){e&&e.selectedDate&&e.selectedDate.currentValue&&this.writeValue(this.selectedDate)},e.prototype.onDocumentClick=function(e){this.elementRef.nativeElement.contains(e.target)||(this.openChooseYearAndMonth=!1,this.resetYearOptions())},e.prototype.onClick=function(e){e.stopPropagation()},Object.defineProperty(e.prototype,"dateConfig",{get:function(){return this._dateConfig},set:function(e){this.checkDateConfig(e)?(this._dateConfig=e,this._dateFormat=this.showTime?e.format.time:e.format.date):this._dateConfig=this.datePickerConfig.dateConfig},enumerable:!0,configurable:!0}),e.prototype.checkDateConfig=function(e){return!!e&&!!("boolean"==typeof e.timePicker&&e.max&&e.min&&e.format)},Object.defineProperty(e.prototype,"minDate",{get:function(){return this._minDate},set:function(e){var t=this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale);t&&(this._minDate=t,this.onYearRangeChange())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{get:function(){return this._maxDate},set:function(e){var t=this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale);t&&(this._maxDate=t,this.onYearRangeChange())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this._dateFormat},set:function(e){this._dateFormat!==e&&(this._dateFormat=e)},enumerable:!0,configurable:!0}),e.prototype.resetYearOptions=function(){var e=this.selectedDate?this.selectedDate.getFullYear():(new Date).getFullYear();this.currentYear=e,this.nowMinYear=e-Math.floor(this.yearNumber/2)<this.minDate.getFullYear()?this.minDate.getFullYear():e-Math.floor(this.yearNumber/2),this.nowMaxYear=this.nowMinYear+this.yearNumber>this.maxDate.getFullYear()?this.maxDate.getFullYear():this.nowMinYear+this.yearNumber,this.onYearRangeChange()},e.prototype.onYearRangeChange=function(){var e=this;if(this.nowMinYear&&this.nowMaxYear){var t=this.yearNumber>this.nowMaxYear-this.nowMinYear+1?this.nowMaxYear-this.nowMinYear+1:this.yearNumber;this.yearOptions=new Array(t).fill(0).map((function(t,n){return e.nowMinYear+n}))}},e.prototype.writeValue=function(e){e&&(this.selectedDate=e?this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale):null,this.onSelectDateChanged(),this.onDisplayWeeksChange(),this.availableMonths=this.onDisplayMonthsChange(),this.changeDetectorRef.markForCheck())},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.hasPreMonth=function(){return this.currentYear>this.minDate.getFullYear()||this.currentYear===this.minDate.getFullYear()&&this.currentMonth>this.minDate.getMonth()},e.prototype.onPreMonth=function(){if(this.hasPreMonth()){var e=new Date(this.currentYear,this.currentMonth);e.setMonth(e.getMonth()-1),this.currentMonth=e.getMonth(),this.currentYear=e.getFullYear(),this.onDisplayWeeksChange()}},e.prototype.hasNextMonth=function(){return this.currentYear<this.maxDate.getFullYear()||this.currentYear===this.maxDate.getFullYear()&&this.currentMonth<this.maxDate.getMonth()},e.prototype.onNextMonth=function(e,t){var n;(this.hasNextMonth()||"init"===t)&&((n=e?new Date(e.getTime()):new Date(this.currentYear,this.currentMonth)).setMonth(n.getMonth()+1),this.currentMonth=n.getMonth(),this.currentYear=n.getFullYear(),this.onDisplayWeeksChange())},e.prototype.hasPreYearOption=function(){return this.nowMinYear>this.minDate.getFullYear()},e.prototype.onPreYearOption=function(){this.hasPreYearOption()&&(this.nowMinYear-this.yearNumber>=this.minDate.getFullYear()?(this.nowMaxYear=this.nowMinYear-1,this.nowMinYear=this.nowMinYear-this.yearNumber):(this.nowMaxYear=this.nowMinYear-1,this.nowMinYear=this.minDate.getFullYear()),this.onYearRangeChange())},e.prototype.hasNextYearOption=function(){return this.nowMaxYear<this.maxDate.getFullYear()},e.prototype.onNextYearOption=function(){this.hasNextYearOption()&&(this.nowMaxYear+this.yearNumber<=this.maxDate.getFullYear()?(this.nowMinYear=this.nowMaxYear+1,this.nowMaxYear=this.nowMaxYear+this.yearNumber):(this.nowMinYear=this.nowMaxYear+1,this.nowMaxYear=this.maxDate.getFullYear()),this.onYearRangeChange())},e.prototype.onSelectYear=function(e,t){t&&t.stopPropagation(),this.currentYear=e,this.onDisplayWeeksChange(),this.availableMonths=this.onDisplayMonthsChange()},e.prototype.onSelectDateChanged=function(){var e=this.selectedDate||new Date;e.getTime()<this.minDate.getTime()&&(e=this.minDate),e.getTime()>this.maxDate.getTime()&&(e=this.maxDate),this.currentYear=e.getFullYear(),this.currentMonth=e.getMonth(),this.currentHour=this.showTime?e.getHours():0,this.currentMinute=this.showTime?e.getMinutes():0,this.currentSecond=this.showTime?e.getSeconds():0},e.prototype.onDisplayWeeksChange=function(){for(var t=this,n=new Date(this.currentYear,this.currentMonth,1),i=n.getDay(),r=new Date(n.getTime()-i*e.DAY_DURATION),a=[],o=function(n){var i=r.getTime()+7*n*e.DAY_DURATION,o=new Array(7).fill(0).map((function(n,r){var a=new Date(i+r*e.DAY_DURATION);return{day:t.fillLeft(a.getDate()),date:a,inMonth:a.getMonth().toString()===t.currentMonth.toString()}}));a.push(o)},s=0;s<6;s++)o(s);this.displayWeeks=a},e.prototype.onDisplayMonthsChange=function(){var e,t,n,i,r=[0,1,2,3,4,5,6,7,8,9,10,11];if(this.currentYear>this.minDate.getFullYear()&&this.currentYear<this.maxDate.getFullYear())return r;if(this.currentYear<this.minDate.getFullYear()||this.currentYear>this.maxDate.getFullYear())return[];var a=[];if(this.currentYear===this.minDate.getFullYear()){try{for(var o=p(r),s=o.next();!s.done;s=o.next()){(c=s.value)>=this.minDate.getMonth()&&a.push(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}return a}if(this.currentYear===this.maxDate.getFullYear()){try{for(var d=p(r),l=d.next();!l.done;l=d.next()){var c;(c=l.value)<=this.maxDate.getMonth()&&a.push(c)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}return a}},e.prototype.fillLeft=function(e){return e<10?"0"+e:""+e},e.prototype.isDisabledDay=function(e){var t=new Date(this.minDate.getFullYear(),this.minDate.getMonth(),this.minDate.getDate()),n=new Date(this.maxDate.getFullYear(),this.maxDate.getMonth(),this.maxDate.getDate(),23,59,59);e.getTime(),t.getTime();return this.disabled||e.getTime()<t.getTime()||e.getTime()>n.getTime()},e.prototype.isSelectDay=function(e){return!(!this.selectedDate||!e)&&(e.getFullYear()===this.selectedDate.getFullYear()&&e.getMonth()===this.selectedDate.getMonth()&&e.getDate()===this.selectedDate.getDate())},e.prototype.onSelectDate=function(e,t,n){e.stopPropagation&&e.stopPropagation(),this.isDisabledDay(t)||(this.selectedDate=new Date(t.getFullYear(),t.getMonth(),t.getDate(),this.currentHour,this.currentMinute,this.currentSecond),this.onTouched(),this.writeValue(this.selectedDate),"init"!==n&&(this.onChange(this.selectedDate),this.selectedDateChange.emit({reason:m.date,selectedDate:this.selectedDate})),this.currentMonth===this.selectedDate.getMonth()&&this.currentYear===this.selectedDate.getFullYear()||(this.currentYear=this.selectedDate.getFullYear(),this.currentMonth=this.selectedDate.getMonth(),this.onDisplayWeeksChange()))},e.prototype.onTimeChange=function(){var e=this.selectedDate||new Date;this.selectedDate=new Date(e.getFullYear(),e.getMonth(),e.getDate(),this.currentHour,this.currentMinute,this.currentSecond),this.onTouched(),this.writeValue(this.selectedDate),this.onChange(this.selectedDate),this.selectedDateChange.emit({reason:m.time,selectedDate:this.selectedDate})},e.prototype.timeUp=function(e){switch(e){case"h":this.currentHour<23?this.currentHour+=1:this.currentHour=0;break;case"m":this.currentMinute<59?this.currentMinute+=1:this.currentMinute=0;break;case"s":this.currentSecond<59?this.currentSecond+=1:this.currentSecond=0}this.onTimeChange()},e.prototype.timeDown=function(e){switch(e){case"h":this.currentHour>0?this.currentHour-=1:this.currentHour=23;break;case"m":this.currentMinute>0?this.currentMinute-=1:this.currentMinute=59;break;case"s":this.currentSecond>0?this.currentSecond-=1:this.currentSecond=59}this.onTimeChange()},e.prototype.toggle=function(e){e.stopPropagation(),this.openChooseYearAndMonth=!this.openChooseYearAndMonth},e.prototype.isTodayDisable=function(){return this.isDisabledDay(new Date)},e.prototype.isDisabledTime=function(){return this.isDisabledDay(this.selectedDate)},e.prototype.initDatePicker=function(){this.selectedDate=this.selectedDate?this.selectedDate:new Date,this.isDisabledDay(this.selectedDate)||(this.selectedDate=this.selectedDate?this.selectedDate:new Date,this.onSelectDateChanged(),this.onSelectDate({},this.selectedDate,"init"))},e.prototype.confirmTime=function(e){e.stopPropagation(),this.writeValue(this.selectedDate),this.onChange(this.selectedDate),this.selectedDateChange.emit({reason:m.button,selectedDate:this.selectedDate})},e.prototype.chooseToday=function(){var e=new Date;this.isDisabledDay(e)||(this.selectedDate=e,this.onSelectDateChanged(),this.onSelectDate({},e))},e.prototype.onSelectMonth=function(e){this.currentMonth=e,this.onDisplayWeeksChange()},e.prototype.changeHoverYear=function(e){this.hoverYear=e},e.prototype.changeHoverMonth=function(e){this.hoverMonth=e},Object.defineProperty(e.prototype,"minDateDefined",{get:function(){return this.minDate.getTime()!==new Date(this.dateConfig.min,0,1,0,0,0).getTime()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDateDefined",{get:function(){return this.maxDate.getTime()!==new Date(this.dateConfig.max,11,31,23,59,59).getTime()},enumerable:!0,configurable:!0}),e.prototype.setI18nText=function(){var e=this;this.i18nText=this.i18n.getI18nText().datePicker,this.i18nLocale=this.i18n.getI18nText().locale,this.i18nCommonText=this.i18n.getI18nText().common,this.i18nSubscription=this.i18n.langChange().subscribe((function(t){e.i18nText=t.datePicker,e.i18nLocale=t.locale,e.i18nCommonText=t.common}))},e.prototype.ngOnDestroy=function(){this.i18nSubscription&&this.i18nSubscription.unsubscribe()},e.DAY_DURATION=864e5,e.decorators=[{type:t.Component,args:[{selector:"d-datepicker",template:'<div class="devui-month-view {{ cssClass }}">\r\n <table class="devui-table devui-month-view-table">\r\n <thead class="devui-noSelect">\r\n <tr>\r\n <td>\r\n <a\r\n *ngIf="openChooseYearAndMonth"\r\n class="devui-btn-link"\r\n aria-hidden="true"\r\n (click)="onPreYearOption()"\r\n [ngClass]="{\r\n \'devui-year-month-disabled\': !hasPreYearOption() || !openChooseYearAndMonth\r\n }"\r\n >\r\n <span class="left-triangle"></span>\r\n <span class="left-triangle second"></span>\r\n </a>\r\n </td>\r\n <td>\r\n <a\r\n class="devui-btn-link devui-btn-left"\r\n aria-hidden="true"\r\n (click)="onPreMonth()"\r\n [ngClass]="{ \'devui-year-month-disabled\': !hasPreMonth() }"\r\n >\r\n <svg\r\n width="16px"\r\n height="16px"\r\n viewBox="0 0 16 16"\r\n version="1.1"\r\n xmlns="http://www.w3.org/2000/svg"\r\n xmlns:xlink="http://www.w3.org/1999/xlink"\r\n >\r\n <g id="collapse-left" stroke="none" stroke-width="1" fill-rule="evenodd">\r\n <g>\r\n <polygon\r\n id="left-path"\r\n fill-rule="nonzero"\r\n points="10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"\r\n ></polygon>\r\n </g>\r\n </g>\r\n </svg>\r\n </a>\r\n </td>\r\n <td colspan="3" class="devui-dropdown" [ngClass]="{ open: openChooseYearAndMonth }" (click)="toggle($event)">\r\n <span class="devui-date-title">{{ (i18nText?.monthsOfYear)[currentMonth] }}</span>\r\n <span class="devui-date-title">{{ currentYear }}</span>\r\n <ul class="devui-dropdown-menu devui-monthOption text-center">\r\n <li\r\n *ngFor="let month of availableMonths"\r\n class="devui-dropdown-item"\r\n (mouseover)="changeHoverMonth(month)"\r\n (mouseleave)="changeHoverMonth(null)"\r\n [ngClass]="{ active: currentMonth == month }"\r\n (click)="onSelectMonth(month)"\r\n >\r\n {{ month + 1 }}\r\n </li>\r\n </ul>\r\n <ul class="devui-dropdown-menu devui-yearOption text-center">\r\n <li\r\n *ngFor="let item of yearOptions"\r\n class="devui-dropdown-item"\r\n (mouseover)="changeHoverYear(item)"\r\n (mouseleave)="changeHoverYear(null)"\r\n [ngClass]="{ active: currentYear == item }"\r\n (click)="onSelectYear(item, $event)"\r\n >\r\n {{ item }}\r\n </li>\r\n </ul>\r\n </td>\r\n <td>\r\n <a\r\n class="devui-btn-link devui-btn-right"\r\n aria-hidden="true"\r\n (click)="onNextMonth()"\r\n [ngClass]="{ \'devui-year-month-disabled\': !hasNextMonth() }"\r\n >\r\n <svg\r\n width="16px"\r\n height="16px"\r\n viewBox="0 0 16 16"\r\n version="1.1"\r\n xmlns="http://www.w3.org/2000/svg"\r\n xmlns:xlink="http://www.w3.org/1999/xlink"\r\n >\r\n <g id="collapse-right" stroke="none" stroke-width="1" fill-rule="evenodd">\r\n <g>\r\n <polygon\r\n id="right-path"\r\n fill-rule="nonzero"\r\n points="10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"\r\n ></polygon>\r\n </g>\r\n </g>\r\n </svg>\r\n </a>\r\n </td>\r\n <td>\r\n <a\r\n *ngIf="openChooseYearAndMonth"\r\n class="devui-btn-link"\r\n aria-hidden="true"\r\n (click)="onNextYearOption()"\r\n [ngClass]="{\r\n \'devui-year-month-disabled\': !hasNextYearOption() || !openChooseYearAndMonth\r\n }"\r\n >\r\n <span class="right-triangle"></span>\r\n <span class="right-triangle second"></span>\r\n </a>\r\n </td>\r\n </tr>\r\n <tr class="small text-center devui-week-header">\r\n <td *ngFor="let item of i18nText?.daysOfWeek">{{ item }}</td>\r\n </tr>\r\n </thead>\r\n <tbody class="devui-noSelect">\r\n <tr *ngFor="let week of displayWeeks">\r\n <td\r\n *ngFor="let day of week"\r\n class="devui-day"\r\n [ngClass]="{\r\n \'devui-out-of-month\': !day.inMonth,\r\n \'devui-in-month-day\': day.inMonth,\r\n active: isSelectDay(day.date),\r\n disabled: isDisabledDay(day.date)\r\n }"\r\n (click)="onSelectDate($event, day.date)"\r\n >\r\n <div class="devui-calendar-date">{{ day.day }}</div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n <tfoot [ngClass]="{ \'devui-noSelect\': !customViewTemplate }">\r\n <tr class="time-picker-view" (click)="!customViewTemplate && $event.stopPropagation()">\r\n <ng-container *ngIf="!customViewTemplate">\r\n <td colspan="4">\r\n <div class="devui-timepicker" *ngIf="showTime" [ngClass]="{ \'devui-timepicker-disabled\': isDisabledTime() }">\r\n <div class="devui-time">\r\n <input type="number" [(ngModel)]="currentHour" (change)="onTimeChange()" max="23" min="0" [disabled]="isDisabledTime()" />\r\n <div class="devui-btn-nav" *ngIf="!isDisabledTime()">\r\n <div class="btn-up" (click)="timeUp(\'h\')"></div>\r\n <div class="btn-down" (click)="timeDown(\'h\')"></div>\r\n </div>\r\n </div>\r\n <div class="devui-time">\r\n <input\r\n type="number"\r\n class="devui-minutes"\r\n [(ngModel)]="currentMinute"\r\n (change)="onTimeChange()"\r\n max="59"\r\n min="0"\r\n [disabled]="isDisabledTime()"\r\n />\r\n <div class="devui-btn-nav" *ngIf="!isDisabledTime()">\r\n <div class="btn-up" (click)="timeUp(\'m\')"></div>\r\n <div class="btn-down" (click)="timeDown(\'m\')"></div>\r\n </div>\r\n </div>\r\n <div class="devui-time">\r\n <input\r\n type="number"\r\n class="devui-seconds"\r\n [(ngModel)]="currentSecond"\r\n (change)="onTimeChange()"\r\n max="59"\r\n min="0"\r\n [disabled]="isDisabledTime()"\r\n />\r\n <div class="devui-btn-nav" *ngIf="!isDisabledTime()">\r\n <div class="btn-up" (click)="timeUp(\'s\')"></div>\r\n <div class="btn-down" (click)="timeDown(\'s\')"></div>\r\n </div>\r\n </div>\r\n </div>\r\n </td>\r\n <td colspan="3">\r\n <div class="devui-btn-wrapper" *ngIf="showTime">\r\n <d-button bsStyle="primary" [disabled]="disabled" (btnClick)="confirmTime($event)" bsSize="sm"\r\n >{{ i18nCommonText?.btnConfirm }}\r\n </d-button>\r\n </div>\r\n <div class="devui-btn-wrapper" *ngIf="!showTime">\r\n <d-button bsStyle="primary" [disabled]="isTodayDisable()" (btnClick)="chooseToday()" bsSize="sm"\r\n >{{ i18nText?.today }}\r\n </d-button>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngIf="customViewTemplate">\r\n <td colspan="7">\r\n <ng-template\r\n [ngTemplateOutlet]="customViewTemplate"\r\n [ngTemplateOutletContext]="{ $implicit: this, chooseDate: chooseDate, clearAll: clearAll }"\r\n ></ng-template>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </tfoot>\r\n </table>\r\n</div>\r\n',providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return e})),multi:!0}],styles:[".devui-month-view{background-color:#fff;font-size:12px;width:240px;text-align:center;box-shadow:0 4px 8px 0 rgba(41,48,64,.2);border-radius:2px;position:relative}.devui-month-view .devui-month-view-table{margin-bottom:0;background:#fff;table-layout:fixed;border-collapse:collapse}.devui-month-view .devui-date-title{font-weight:700;cursor:pointer;font-size:12px}.devui-month-view .devui-btn-link{text-decoration:none;cursor:pointer}.devui-month-view .devui-btn-link.devui-year-month-disabled{opacity:.3;cursor:not-allowed}.devui-month-view .devui-btn-link .left-triangle,.devui-month-view .devui-btn-link .right-triangle{display:inline-block;position:absolute;top:6px;width:0;height:0;border:6px solid}.devui-month-view .devui-btn-link .left-triangle{left:6px;border-color:transparent #252b3a transparent transparent}.devui-month-view .devui-btn-link .right-triangle{right:6px;border-color:transparent transparent transparent #252b3a}.devui-month-view .devui-btn-link .left-triangle.second{left:12px}.devui-month-view .devui-btn-link .right-triangle.second{right:12px}.devui-month-view .devui-btn-link svg #left-path,.devui-month-view .devui-btn-link svg #right-path{fill:#252b3a}.devui-month-view .devui-btn-link:not(.devui-year-month-disabled):hover .left-triangle{border-right-color:#344899}.devui-month-view .devui-btn-link:not(.devui-year-month-disabled):hover .right-triangle{border-left-color:#344899}.devui-month-view .devui-btn-link:not(.devui-year-month-disabled):hover #left-path,.devui-month-view .devui-btn-link:not(.devui-year-month-disabled):hover #right-path,.devui-month-view .devui-btn-link:not(.devui-year-month-disabled):hover svg #left-path,.devui-month-view .devui-btn-link:not(.devui-year-month-disabled):hover svg #right-path{fill:#344899}.devui-month-view .devui-btn-link.devui-btn-right{-webkit-transform:scale(-1,1);transform:scale(-1,1);display:inline-block;line-height:1}.devui-month-view .date-select{border:none;background:0 0;outline:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.devui-month-view .devui-week-header{cursor:default;margin-bottom:16px}.devui-month-view .devui-week-header td{width:32px;height:24px;line-height:24px;color:#252b3a;border:none}.devui-month-view .devui-day:not(.disabled){cursor:pointer;font-size:12px;color:#dfe1e6}.devui-month-view .devui-day.disabled{cursor:not-allowed}.devui-calendar-date{display:block;margin:0 3px;width:20px;height:20px;padding:0;line-height:20px;background:0 0;text-align:center;-webkit-transition:background .3s;transition:background .3s;font-size:12px;color:#252b3a}.devui-month-view .devui-day:hover:not(.active):not(.disabled) .devui-calendar-date{background-color:#f2f5fc}.devui-month-view .devui-day.active:hover .devui-calendar-date{background-color:#344899;color:#fff}.devui-month-view .devui-in-month-day.disabled:not(.active) .devui-calendar-date{color:#252b3a;background-color:#dfe1e6;opacity:.8;cursor:not-allowed}.devui-month-view .devui-in-month-day.active .devui-calendar-date{background:#5e7ce0;color:#fff}.devui-month-view .devui-out-of-month .devui-calendar-date{opacity:.8;background-color:#fff;color:#adb0b8}.devui-month-view .devui-minutes:before{content:':';text-align:center;position:absolute;margin-left:-13px}.devui-month-view .devui-seconds:before{content:':';text-align:center;position:absolute;margin-left:-13px;z-index:999}.devui-yearOption{min-width:4em;margin-left:4.5em;max-height:255px;overflow-x:hidden;overflow-y:auto}.devui-monthOption{min-width:3em;margin-left:1em}.devui-monthOption li,.devui-yearOption li{text-align:center}.devui-monthOption li:hover,.devui-yearOption li:hover{background:#344899;color:#fff;cursor:pointer}.devui-monthOption li.active,.devui-yearOption li.active{color:#fff;background-color:#5e7ce0}.devui-monthOption li.active:hover,.devui-yearOption li.active:hover{background-color:#344899}.devui-month-view .devui-timepicker{background:#f8f8f8;display:-webkit-box;display:flex;-webkit-box-pack:space-evenly;justify-content:space-evenly}.devui-month-view .devui-timepicker input{outline:0;border:0;background:#f8f8f8;color:#252b3a;width:30px;padding:0 0 0 3px;height:30px;text-align:center}.devui-month-view .devui-timepicker.devui-timepicker-disabled input{cursor:not-allowed;opacity:.3}.devui-month-view .devui-timepicker .devui-time{position:relative;display:inline-block;width:40px}.devui-month-view .devui-timepicker .devui-time:not(:first-child):before{content:':'}.devui-month-view .devui-table>tbody>tr>td{vertical-align:middle;padding:4px;border-top:none}.devui-month-view .devui-table>tbody>tr>td:not(.disabled){border-top:none;background:#fff}.devui-month-view .devui-table>thead>tr>td{vertical-align:top;line-height:1.5;padding:4px}.devui-noSelect{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.devui-month-view .devui-month-view-table td{border-bottom:none}.devui-month-view .devui-table tfoot{border-top:1px solid #f8f8f8}.devui-month-view tfoot td{padding:2px;vertical-align:middle;border-top:none}.devui-dropdown-menu{font-size:12px}.devui-btn-wrapper{margin-top:0}.devui-btn-nav{display:none;position:absolute;right:9px;top:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.devui-btn-nav .btn-down,.devui-btn-nav .btn-up{position:absolute;width:0;height:0;border:6px solid}.devui-btn-nav .btn-up{padding-top:2px;padding-bottom:1px;border-color:transparent transparent #252b3a}.devui-btn-nav .btn-up:hover{border-color:transparent transparent #344899}.devui-btn-nav .btn-down{top:16px;padding-bottom:4px;border-color:#252b3a transparent transparent}.devui-btn-nav .btn-down:hover{border-color:#344899 transparent transparent}.devui-time input[type=number]::-webkit-inner-spin-button,.devui-time input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.devui-time input[type=number]{-moz-appearance:textfield}.devui-time:hover .devui-btn-nav{display:block}:host ::ng-deep .cdk-overlay-pane d-datepicker.devui-dropdown-menu{padding:0}"]}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:g},{type:t.ChangeDetectorRef},{type:r.I18nService}]},e.propDecorators={showTime:[{type:t.Input}],cssClass:[{type:t.Input}],dateConverter:[{type:t.Input}],locale:[{type:t.Input}],selectedDateChange:[{type:t.Output}],disabled:[{type:t.Input}],yearNumber:[{type:t.Input}],customViewTemplate:[{type:t.Input}],selectedDate:[{type:t.Input}],onDocumentClick:[{type:t.HostListener,args:["document:click",["$event"]]}],onClick:[{type:t.HostListener,args:["click",["$event"]]}],dateConfig:[{type:t.Input}],minDate:[{type:t.Input}],maxDate:[{type:t.Input}],dateFormat:[{type:t.Input}]},e}();var y="cubic-bezier(0.755, 0.05, 0.855, 0.06)",b=function(){function e(e,n,r,a,d,l,c,h){var u=this;this.elementRef=e,this.viewContainerRef=n,this.componentFactoryResolver=r,this.renderer2=a,this.injector=d,this.datePickerConfig=l,this.i18n=c,this.builder=h,this.direction="down",this.autoOpen=!1,this.selectedDateChange=new t.EventEmitter,this.isOpen=!1,this.onChange=function(e){return null},this.onTouched=function(){return null},this._dateConfig=l.dateConfig,this.dateConverter=l.dateConfig.dateConverter||new i.DefaultDateConverter,this.selectedDate=null;var p=this.componentFactoryResolver.resolveComponentFactory(f);this.cmpRef=this.viewContainerRef.createComponent(p,this.viewContainerRef.length,this.injector),this.inputSub=o.fromEvent(this.elementRef.nativeElement,"input").pipe(s.debounceTime(300)).subscribe((function(e){u.transUserInputToDatepicker(e)}))}return Object.defineProperty(e.prototype,"dateConfig",{get:function(){return this._dateConfig},set:function(e){e?(this._dateConfig=e,this._dateFormat=this.showTime?e.format.time:e.format.date):this._dateConfig=this.datePickerConfig.dateConfig},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this._dateFormat},set:function(e){this._dateFormat!==e&&(this._dateFormat=e,this.writeModelValue({selectedDate:this.selectedDate,reason:m.format}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{get:function(){return this._maxDate},set:function(e){var t=this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale);t&&(this._maxDate=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDate",{get:function(){return this._minDate},set:function(e){var t=this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale);t&&(this._minDate=t)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.showTime=this.showTime||this.dateConfig.timePicker,this._minDate=this.minDate?new Date(this.minDate):new Date(this.dateConfig.min,0,1,0,0,0),this._maxDate=this.maxDate?new Date(this.maxDate):new Date(this.dateConfig.max,11,31,23,59,59);var t=this.cmpRef.location.nativeElement;this.applyPopupStyling(t);var n=this.cmpRef.instance;this.renderer2.setStyle(t,"display","none"),n.writeValue(this.selectedDate),this.fillPopupData(),n.ngOnInit(),n.registerOnChange((function(t){e.writeValue(t),e.onChange(t)})),n.selectedDateChange.subscribe((function(t){(t.reason===m.date&&!e.showTime||t.reason===m.button)&&e.hide()})),this.autoOpen&&this.show(),this.setI18nText()},e.prototype.writeValue=function(e){var t;t=e&&"object"==typeof e&&e.hasOwnProperty("selectedDate")?e.selectedDate:e,this.selectedDate=t?this.dateConverter.parse(t,this.dateFormat,this.locale||this.i18nLocale):null,this.writeModelValue(e)},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setI18nText=function(){var e=this;this.i18nLocale=this.i18n.getI18nText().locale,this.i18nSubscription=this.i18n.langChange().subscribe((function(t){e.i18nLocale=t.locale}))},e.prototype.parseDateFunc=function(e,t){this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale)&&(this[t]=e)},e.prototype.applyPopupStyling=function(e){this.renderer2.addClass(e,"devui-dropdown-menu"),this.renderer2.setStyle(e,"padding","0px"),"up"===this.direction&&(this.renderer2.setStyle(e,"top","auto"),this.renderer2.setStyle(e,"bottom","100%"))},e.prototype.hide=function(){var e=!1!==this.isOpen;this.isOpen=!1,e&&this.playAnimation()},e.prototype.writeModelValue=function(e){var t,n=m.time;e&&"object"==typeof e&&e.hasOwnProperty("selectedDate")?(t=e.selectedDate,n=e.reason):t=e;var i=(t=t?new Date(t):null)?this.dateConverter.format(t,this.dateFormat,this.locale||this.i18nLocale):"";this.renderer2.setProperty(this.elementRef.nativeElement,"value",i),this.isOpen&&this.cmpRef.instance.writeValue(this.selectedDate),this.selectedDateChange.emit({reason:n,selectedDate:this.selectedDate})},e.prototype.show=function(){this.cmpRef.instance.writeValue(this.selectedDate),this.fillPopupData();var e=!0!==this.isOpen;this.isOpen=!0,e&&this.playAnimation()},e.prototype.toggle=function(e){e&&e.stopPropagation(),this.isOpen?this.hide():this.show()},e.prototype.fillPopupData=function(){var e=this;["showTime","maxDate","minDate","cssClass","disabled","dateConverter","locale","dateFormat","yearNumber","dateConfig","customViewTemplate"].forEach((function(t){void 0!==e[t]&&(e.cmpRef.instance[t]=e[t])}))},e.prototype.onBlur=function(e){this.onTouched()},e.prototype.onDocumentClick=function(e){this.elementRef.nativeElement!==e.target&&this.hide()},e.prototype.clearAll=function(){this.cmpRef.instance.clearAll()},e.prototype.popIn=function(e){switch(e){case"top":return[a.style({transform:"perspective(1px) scale(0.9)",opacity:0,transformOrigin:"0% 100%",display:"inline-block"}),a.animate("200ms cubic-bezier(0.23, 1, 0.32, 1)",a.style({transform:"perspective(1px) scale(1)",opacity:1,transformOrigin:"0% 100%"}))];case"bottom":default:return[a.style({transform:"perspective(1px) scale(0.9)",opacity:0,transformOrigin:"0% 0%",display:"inline-block"}),a.animate("200ms cubic-bezier(0.23, 1, 0.32, 1)",a.style({transform:"perspective(1px) scale(1)",opacity:1,transformOrigin:"0% 0%"}))]}},e.prototype.popOut=function(e){switch(e){case"top":return[a.style({transform:"perspective(1px) scale(1)",opacity:1,transformOrigin:"0% 100%"}),a.animate("200ms "+y,a.style({transform:"perspective(1px) scale(0.9)",opacity:0,transformOrigin:"0% 100%"}))];case"bottom":default:return[a.style({transform:"perspective(1px) scale(1)",opacity:1,transformOrigin:"0% 0%"}),a.animate("200ms "+y,a.style({transform:"perspective(1px) scale(0.9)",opacity:0,transformOrigin:"0% 0%"}))]}},e.prototype.playAnimation=function(){var e=this;this.player&&this.player.destroy();var t="";switch(this.direction){case"down":t="bottom";break;case"up":t="top";break;default:t="bottom"}var n=this.isOpen?this.popIn(t):this.popOut(t),i=this.builder.build(n);this.renderer2.setStyle(this.cmpRef.location.nativeElement,"display","inline-block"),this.player=i.create(this.cmpRef.location.nativeElement),this.player.onDone((function(){if(!e.isOpen){var t=e.cmpRef.location.nativeElement;e.renderer2.setStyle(t,"display","none")}})),this.player.play()},e.prototype.transUserInputToDatepicker=function(e){if(this.showTime||this.disabled)this.elementRef.nativeElement.value=this.dateConverter.format(this.selectedDate,this.dateFormat,this.locale||this.i18nLocale);else{var t=e.target.value,n=new Date(t),i=this.dateConverter.format(n,this.dateFormat,this.locale||this.i18nLocale);t&&t===i?n.getTime()<this.minDate.getTime()||n.getTime()>this.maxDate.getTime()?this.elementRef.nativeElement.value=this.dateConverter.format(this.selectedDate,this.dateFormat,this.locale||this.i18nLocale):this.cmpRef.instance.chooseDate(t):t||this.clearAll()}},e.prototype.ngOnDestroy=function(){this.inputSub&&this.inputSub.unsubscribe(),this.i18nSubscription&&this.i18nSubscription.unsubscribe()},e.decorators=[{type:t.Directive,args:[{selector:"[dDatepicker]:not([appendToBody])",exportAs:"datepicker",providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return e})),multi:!0}]}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.ViewContainerRef},{type:t.ComponentFactoryResolver},{type:t.Renderer2},{type:t.Injector},{type:g},{type:r.I18nService},{type:a.AnimationBuilder}]},e.propDecorators={dateConfig:[{type:t.Input}],dateFormat:[{type:t.Input}],maxDate:[{type:t.Input}],minDate:[{type:t.Input}],locale:[{type:t.Input}],showTime:[{type:t.Input}],cssClass:[{type:t.Input}],disabled:[{type:t.Input}],dateConverter:[{type:t.Input}],yearNumber:[{type:t.Input}],direction:[{type:t.Input}],customViewTemplate:[{type:t.Input}],autoOpen:[{type:t.Input}],selectedDateChange:[{type:t.Output}],onBlur:[{type:t.HostListener,args:["blur",["$event"]]}],onDocumentClick:[{type:t.HostListener,args:["document:click",["$event"]]}]},e}();var w=function(){function e(e,n,r,a,d){var l=this;this.elementRef=e,this.viewContainerRef=n,this.renderer2=r,this.datePickerConfig=a,this.i18n=d,this.yearNumber=12,this.autoOpen=!1,this.selectedDateChange=new t.EventEmitter,this.isOpen=!1,this.datepickerPosition="bottom",this.clickShow=!1,this.appendToBodyDirections=["rightDown","leftDown","rightUp","leftUp"],this.onChange=function(e){return null},this.onTouched=function(){return null},this.clearAll=function(){l.writeValue(null)},this._dateConfig=a.dateConfig,this.dateConverter=a.dateConfig.dateConverter||new i.DefaultDateConverter,this.inputSub=o.fromEvent(this.elementRef.nativeElement,"input").pipe(s.debounceTime(300)).subscribe((function(e){l.transUserInputToDatepicker(e)}))}return Object.defineProperty(e.prototype,"dateConfig",{get:function(){return this._dateConfig},set:function(e){e?(this._dateConfig=e,this._dateFormat=this.showTime?e.format.time:e.format.date):this._dateConfig=this.datePickerConfig.dateConfig},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this._dateFormat},set:function(e){this._dateFormat!==e&&(this._dateFormat=e,this.writeModelValue({selectedDate:this.selectedDate,reason:m.format}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{get:function(){return this._maxDate},set:function(e){var t=this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale);t&&(this._maxDate=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDate",{get:function(){return this._minDate},set:function(e){var t=this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale);t&&(this._minDate=t)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.showTime=this.showTime||this.dateConfig.timePicker,this._minDate=this.minDate?new Date(this.minDate):new Date(this.dateConfig.min,0,1,0,0,0),this._maxDate=this.maxDate?new Date(this.maxDate):new Date(this.dateConfig.max,11,31,23,59,59),this.setPositions(),this.setI18nText(),this.updateCdkConnectedOverlayOrigin(),this.autoOpen&&(this.isOpen=!0)},e.prototype.ngOnChanges=function(e){e.appendToBodyDirections&&this.setPositions()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.writeValue=function(e){this.selectedDate=e?this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale):null;var t=this.selectedDate?this.dateConverter.format(this.selectedDate,this.dateFormat,this.locale||this.i18nLocale):"";this.renderer2.setProperty(this.elementRef.nativeElement,"value",t)},e.prototype.setI18nText=function(){var e=this;this.i18nLocale=this.i18n.getI18nText().locale,this.i18nSubscription=this.i18n.langChange().subscribe((function(t){e.i18nLocale=t.locale}))},e.prototype.timeChange=function(e){this.writeValue(e.selectedDate),this.writeModelValue(e),(e.reason===m.date&&!this.showTime||e.reason===m.button)&&(this.isOpen=!1)},e.prototype.updateCdkConnectedOverlayOrigin=function(){this.elementRef.nativeElement&&(this.cdkConnectedOverlayOrigin=new l.CdkOverlayOrigin(this.elementRef.nativeElement))},e.prototype.toggle=function(e,t){this.isOpen=!this.isOpen,this.clickShow=t},e.prototype.hide=function(){this.isOpen=!1},e.prototype.writeModelValue=function(e){var t,n=m.time;e&&"object"==typeof e&&e.hasOwnProperty("selectedDate")?(t=e.selectedDate,n=e.reason):t=e,t=t?new Date(t):null,this.onChange(t),this.selectedDateChange.emit({reason:n,selectedDate:this.selectedDate})},e.prototype.onBlur=function(e){this.onTouched()},e.prototype.onDocumentClick=function(e){this.elementRef.nativeElement===e.target||this.clickShow?this.clickShow=!1:this.isOpen=!1},e.prototype.onPositionChange=function(e){switch(e.connectionPair.overlayY){case"top":case"center":this.datepickerPosition="bottom";break;case"bottom":this.datepickerPosition="top"}},e.prototype.setPositions=function(){this.appendToBodyDirections&&this.appendToBodyDirections.length>0?this.positions=this.appendToBodyDirections.map((function(e){return"string"==typeof e?i.AppendToBodyDirectionsConfig[e]:e})).filter((function(e){return void 0!==e})):this.positions=void 0},e.prototype.transUserInputToDatepicker=function(e){if(this.showTime||this.disabled)this.writeValue(this.selectedDate);else{var t=e.target.value,n=new Date(t),i=this.dateConverter.format(n,this.dateFormat,this.locale||this.i18nLocale);t&&t===i?n.getTime()<this.minDate.getTime()||n.getTime()>this.maxDate.getTime()?this.writeValue(this.selectedDate):(this.selectedDate=new Date(t),this.writeModelValue(t)):t||this.writeValue(null)}},e.prototype.ngOnDestroy=function(){this.inputSub&&this.inputSub.unsubscribe(),this.i18nSubscription&&this.i18nSubscription.unsubscribe()},e.decorators=[{type:t.Component,args:[{selector:"[dDatepicker][appendToBody]",providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return e})),multi:!0}],exportAs:"datepicker",template:'\n <ng-template cdk-connected-overlay\n [cdkConnectedOverlayOrigin]="cdkConnectedOverlayOrigin"\n [cdkConnectedOverlayPositions]="positions"\n [cdkConnectedOverlayOpen]="isOpen"\n (backdropClick)="isOpen=false"\n (positionChange)="onPositionChange($event)">\n <d-datepicker [@cornerFadeInOut]="isOpen ? datepickerPosition : \'void\'" [locale]="locale || i18nLocale"\n [showTime]="showTime" [cssClass]="cssClass" [selectedDate]="selectedDate"\n [disabled]="disabled" [dateConverter]="dateConverter" (selectedDateChange)="timeChange($event)"\n [yearNumber]="yearNumber" [dateFormat]="dateFormat" [dateConfig]="dateConfig"\n [customViewTemplate]="customViewTemplate" [maxDate]="maxDate"\n [minDate]="minDate" class="devui-datepicker"></d-datepicker>\n </ng-template>\n ',animations:[i.cornerFadeInOut],styles:[".devui-datepicker{-webkit-transform:perspective(1px) translate3d(0,0,0);transform:perspective(1px) translate3d(0,0,0)}"]}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.ViewContainerRef},{type:t.Renderer2},{type:g},{type:r.I18nService}]},e.propDecorators={locale:[{type:t.Input}],showTime:[{type:t.Input}],cssClass:[{type:t.Input}],disabled:[{type:t.Input}],dateConverter:[{type:t.Input}],yearNumber:[{type:t.Input}],customViewTemplate:[{type:t.Input}],autoOpen:[{type:t.Input}],selectedDateChange:[{type:t.Output}],dateConfig:[{type:t.Input}],dateFormat:[{type:t.Input}],maxDate:[{type:t.Input}],minDate:[{type:t.Input}],appendToBodyDirections:[{type:t.Input}],onBlur:[{type:t.HostListener,args:["blur",["$event"]]}],onDocumentClick:[{type:t.HostListener,args:["document:click",["$event"]]}]},e}();var D={date:0,time:1,button:2};D[D.date]="date",D[D.time]="time",D[D.button]="button";var k=function(){function e(e,n,r,a,d){var l=this;this.elementRef=e,this.viewContainerRef=n,this.renderer=r,this.datePickerConfig=a,this.i18n=d,this.selectedRange=[null,null],this.showTime=!1,this.hideOnRangeSelected=!1,this.splitter=" - ",this.selectedRangeChange=new t.EventEmitter,this._isOpen=!1,this.clickShow=!1,this.currentCalendars=[null,null],this.hoverOnDate=new o.Subject,this.datepickerPosition="bottom",this.onChange=function(e){return null},this.onTouched=function(){return null},this.chooseDate=function(e){l.writeValue(e),l.notifyValueChange(e,D.date),!l.showTime&&l.hideOnRangeSelected&&l.hide()},this.clearAll=function(){l.rangeChange({selectedRange:[null,null]})},this._dateConfig=a.dateConfig,this.dateConverter=a.dateConfig.dateConverter||new i.DefaultDateConverter,this.inputSub=o.fromEvent(this.elementRef.nativeElement,"input").pipe(s.debounceTime(300)).subscribe((function(e){l.transUserInputToDatepicker(e)}))}return Object.defineProperty(e.prototype,"dateConfig",{get:function(){return this._dateConfig},set:function(e){e?(this._dateConfig=e,this._dateFormat=this.showTime?e.format.time:e.format.date):this._dateConfig=this.datePickerConfig.dateConfig},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateFormat",{get:function(){return this._dateFormat},set:function(e){this._dateFormat!==e&&(this._dateFormat=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{get:function(){return this._maxDate},set:function(e){var t=this.convertDate(e);t&&(this._maxDate=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minDate",{get:function(){return this._minDate},set:function(e){var t=this.convertDate(e);t&&(this._minDate=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._isOpen},set:function(e){this._isOpen=e,e||this.rangeEnd||(this.rangeStart=null)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this._minDate=this.minDate?new Date(this.minDate):new Date(this.dateConfig.min,0,1,0,0,0),this._maxDate=this.maxDate?new Date(this.maxDate):new Date(this.dateConfig.max,11,31,23,59,59),this.setI18nText(),this.updateCdkConnectedOverlayOrigin(),this.subscribeHoverActions()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.writeValue=function(e){var t;e&&(this.selectedRange=e,Array.isArray(this.selectedRange)&&(t=v(this.selectedRange,2),this.rangeStart=t[0],this.rangeEnd=t[1]),this.writeModelValue(e))},e.prototype.setI18nText=function(){var e=this;this.i18nLocale=this.i18n.getI18nText().locale,this.i18nSubscription=this.i18n.langChange().subscribe((function(t){e.i18nLocale=t.locale}))},e.prototype.rangeChange=function(e){this.chooseDate(e.selectedRange)},e.prototype.updateCdkConnectedOverlayOrigin=function(){this.elementRef.nativeElement&&(this.cdkConnectedOverlayOrigin=new l.CdkOverlayOrigin(this.elementRef.nativeElement))},e.prototype.toggle=function(e,t){this.isOpen=!this.isOpen,this.clickShow=t},e.prototype.hide=function(){this.isOpen=!1},e.prototype.writeModelValue=function(e){Array.isArray(e)&&e.every((function(e){return!!e}))?this.renderer.setProperty(this.elementRef.nativeElement,"value",this.formatDateRange(e)):this.renderer.setProperty(this.elementRef.nativeElement,"value","")},e.prototype.formatDateRange=function(e){var t=this;return e.map((function(e,n){return e?t.dateConverter.format(e,t.dateFormat,t.locale||t.i18nLocale):["Start","End"][n]})).join(this.splitter)},e.prototype.onBlur=function(e){this.onTouched()},e.prototype.onDocumentClick=function(e){this.templateWrap&&this.templateWrap.nativeElement.contains(e.target)&&!this.hideOnRangeSelected?this.isOpen=!0:this.elementRef.nativeElement===e.target||this.clickShow?this.clickShow=!1:this.isOpen=!1},e.prototype.onPositionChange=function(e){switch(e.connectionPair.overlayY){case"top":case"center":this.datepickerPosition="bottom";break;case"bottom":this.datepickerPosition="top"}},e.prototype.convertDate=function(e){return e?this.dateConverter.parse(e,this.dateFormat,this.locale||this.i18nLocale):null},e.prototype.selectingDate=function(e){this.hoverOnDate.next(e)},e.prototype.subscribeHoverActions=function(){var e=this;this.hoverOnDate.pipe(s.distinctUntilChanged()).subscribe((function(t){e.previewRangeEnd(t)}))},e.prototype.previewRangeEnd=function(e){e&&(this.leftPicker.previewEnd=e,this.rightPicker.previewEnd=e)},e.prototype.syncRangeStart=function(e,t){t.selectRange(e,!0)},e.prototype.syncPickerPair=function(e,t){switch(t){case"left":this.currentCalendars[0]=e;break;case"right":this.currentCalendars[1]=e}},e.prototype.notifyValueChange=function(e,t){var n;this.onChange(e),n=void 0===t?D.time:t,this.selectedRangeChange.emit({reason:n,selectedRange:e})},e.prototype.consolidateTime=function(){var e=this.rangeStart,t=this.rangeEnd,n=this.leftPicker.currentTime,i=this.rightPicker.currentTime;this.rangeStart=new Date(e.getFullYear(),e.getMonth(),e.getDate(),n.hour,n.minute,n.second),this.rangeEnd=new Date(t.getFullYear(),t.getMonth(),t.getDate(),i.hou