diff --git a/dist/css/datepicker.css b/dist/css/datepicker.css
index 2a1fe99..67f3f3e 100644
--- a/dist/css/datepicker.css
+++ b/dist/css/datepicker.css
@@ -7,6 +7,13 @@
.-selected-.datepicker--cell-day.-other-month-, .-selected-.datepicker--cell-year.-other-decade- {
color: #fff;
background: #a2ddf6; }
+ .-selected-.-focus-.datepicker--cell-day.-other-month-, .-selected-.-focus-.datepicker--cell-year.-other-decade- {
+ background: #8ad5f4; }
+ .-in-range-.datepicker--cell-day.-other-month-, .-in-range-.datepicker--cell-year.-other-decade- {
+ background-color: #effaff;
+ color: #cccccc; }
+ .-in-range-.-focus-.datepicker--cell-day.-other-month-, .-in-range-.-focus-.datepicker--cell-year.-other-decade- {
+ background-color: #e5f7ff; }
.datepicker--cell-day.-other-month-:empty, .datepicker--cell-year.-other-decade-:empty {
background: none;
border: none; }
@@ -45,15 +52,16 @@
.datepicker--cell.-current-.-focus- {
color: #4a4a4a; }
.datepicker--cell.-in-range- {
- background: #a2ddf6;
- color: #fff;
+ background: #E0F6FF;
+ color: #4a4a4a;
padding: 2px 0;
background-clip: content-box;
border-radius: 0; }
+ .datepicker--cell.-in-range-.-focus- {
+ background-color: #c6efff; }
.datepicker--cell.-disabled- {
cursor: default;
- color: #aeaeae;
- background: none; }
+ color: #aeaeae; }
.datepicker--cell.-disabled-.-focus- {
color: #aeaeae;
background: #f0f0f0; }
@@ -71,6 +79,8 @@
border-radius: 4px 0 0 4px; }
.datepicker--cell.-range-to- {
border-radius: 0 4px 4px 0; }
+ .datepicker--cell.-range-from-.-range-to- {
+ border-radius: 4px; }
.datepicker--days-names {
display: -webkit-flex;
@@ -128,6 +138,13 @@
.-selected-.datepicker--cell-day.-other-month-, .-selected-.datepicker--cell-year.-other-decade- {
color: #fff;
background: #a2ddf6; }
+ .-selected-.-focus-.datepicker--cell-day.-other-month-, .-selected-.-focus-.datepicker--cell-year.-other-decade- {
+ background: #8ad5f4; }
+ .-in-range-.datepicker--cell-day.-other-month-, .-in-range-.datepicker--cell-year.-other-decade- {
+ background-color: #effaff;
+ color: #cccccc; }
+ .-in-range-.-focus-.datepicker--cell-day.-other-month-, .-in-range-.-focus-.datepicker--cell-year.-other-decade- {
+ background-color: #e5f7ff; }
.datepicker--cell-day.-other-month-:empty, .datepicker--cell-year.-other-decade-:empty {
background: none;
border: none; }
@@ -245,6 +262,13 @@
.-selected-.datepicker--cell-day.-other-month-, .-selected-.datepicker--cell-year.-other-decade- {
color: #fff;
background: #a2ddf6; }
+ .-selected-.-focus-.datepicker--cell-day.-other-month-, .-selected-.-focus-.datepicker--cell-year.-other-decade- {
+ background: #8ad5f4; }
+ .-in-range-.datepicker--cell-day.-other-month-, .-in-range-.datepicker--cell-year.-other-decade- {
+ background-color: #effaff;
+ color: #cccccc; }
+ .-in-range-.-focus-.datepicker--cell-day.-other-month-, .-in-range-.-focus-.datepicker--cell-year.-other-decade- {
+ background-color: #e5f7ff; }
.datepicker--cell-day.-other-month-:empty, .datepicker--cell-year.-other-decade-:empty {
background: none;
border: none; }
@@ -345,6 +369,13 @@
.-selected-.datepicker--cell-day.-other-month-, .-selected-.datepicker--cell-year.-other-decade- {
color: #fff;
background: #a2ddf6; }
+ .-selected-.-focus-.datepicker--cell-day.-other-month-, .-selected-.-focus-.datepicker--cell-year.-other-decade- {
+ background: #8ad5f4; }
+ .-in-range-.datepicker--cell-day.-other-month-, .-in-range-.datepicker--cell-year.-other-decade- {
+ background-color: #effaff;
+ color: #cccccc; }
+ .-in-range-.-focus-.datepicker--cell-day.-other-month-, .-in-range-.-focus-.datepicker--cell-year.-other-decade- {
+ background-color: #e5f7ff; }
.datepicker--cell-day.-other-month-:empty, .datepicker--cell-year.-other-decade-:empty {
background: none;
border: none; }
diff --git a/dist/css/datepicker.min.css b/dist/css/datepicker.min.css
index f9f858d..64ff8de 100644
--- a/dist/css/datepicker.min.css
+++ b/dist/css/datepicker.min.css
@@ -1 +1 @@
-.datepicker--cells{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.datepicker--cell{border-radius:4px;cursor:pointer;display:-webkit-flex;display:-ms-flexbox;display:flex;position:relative;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:32px;z-index:1}.datepicker--cell.-focus-{background:#f0f0f0}.datepicker--cell.-current-{color:#4EB5E6}.datepicker--cell.-current-.-focus-{color:#4a4a4a}.datepicker--cell.-in-range-{background:#a2ddf6;color:#fff;padding:2px 0;background-clip:content-box;border-radius:0}.datepicker--cell.-disabled-{cursor:default;color:#aeaeae;background:0 0}.datepicker--cell.-disabled-.-focus-{color:#aeaeae;background:#f0f0f0}.datepicker--cell.-disabled-.-current-:hover{color:#aeaeae}.datepicker--cell.-selected-,.datepicker--cell.-selected-.-current-{color:#fff;background:#5cc4ef}.datepicker--cell.-selected-.-focus-{background:#45bced}.datepicker--cell.-range-from-{border-radius:4px 0 0 4px}.datepicker--cell.-range-to-{border-radius:0 4px 4px 0}.datepicker--days-names{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:8px 0 3px}.datepicker--day-name{color:#FF9A19;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center;text-transform:uppercase;font-size:.8em}.datepicker--body,.datepicker-inline .datepicker--pointer{display:none}.datepicker--cell-day{width:14.28571%}.datepicker--cells-months{height:170px}.datepicker--cell-month{width:33.33%;height:25%}.datepicker--cells-years,.datepicker--years{height:170px}.datepicker--cell-year{width:25%;height:33.33%}.datepickers-container{position:absolute;left:0;top:0}.datepicker{background:#fff;border:1px solid #dbdbdb;box-shadow:0 4px 12px rgba(0,0,0,.15);border-radius:4px;box-sizing:content-box;font-family:Tahoma,sans-serif;font-size:14px;color:#4a4a4a;width:250px;position:absolute;left:-100000px;opacity:0;transition:opacity .3s ease,left 0s .3s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s .3s;transition:opacity .3s ease,transform .3s ease,left 0s .3s,-webkit-transform .3s ease;z-index:100}.datepicker.-from-top-{-webkit-transform:translateY(-8px);transform:translateY(-8px)}.datepicker.-from-right-{-webkit-transform:translateX(8px);transform:translateX(8px)}.datepicker.-from-bottom-{-webkit-transform:translateY(8px);transform:translateY(8px)}.datepicker.-from-left-{-webkit-transform:translateX(-8px);transform:translateX(-8px)}.datepicker.active{opacity:1;-webkit-transform:translate(0);transform:translate(0);transition:opacity .3s ease,left 0s 0s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s 0s;transition:opacity .3s ease,transform .3s ease,left 0s 0s,-webkit-transform .3s ease}.datepicker-inline .datepicker{border-color:#d7d7d7;box-shadow:none;position:static;left:auto;right:auto;opacity:1;-webkit-transform:none;transform:none}.datepicker--content{box-sizing:content-box;padding:4px}.datepicker--pointer{position:absolute;background:#fff;border-top:1px solid #dbdbdb;border-right:1px solid #dbdbdb;width:10px;height:10px;z-index:-1}.datepicker--nav-action:hover,.datepicker--nav-title:hover{background:#f0f0f0}.-top-center- .datepicker--pointer,.-top-left- .datepicker--pointer,.-top-right- .datepicker--pointer{top:calc(100% - 4px);-webkit-transform:rotate(135deg);transform:rotate(135deg)}.-right-bottom- .datepicker--pointer,.-right-center- .datepicker--pointer,.-right-top- .datepicker--pointer{right:calc(100% - 4px);-webkit-transform:rotate(225deg);transform:rotate(225deg)}.-bottom-center- .datepicker--pointer,.-bottom-left- .datepicker--pointer,.-bottom-right- .datepicker--pointer{bottom:calc(100% - 4px);-webkit-transform:rotate(315deg);transform:rotate(315deg)}.-left-bottom- .datepicker--pointer,.-left-center- .datepicker--pointer,.-left-top- .datepicker--pointer{left:calc(100% - 4px);-webkit-transform:rotate(45deg);transform:rotate(45deg)}.-bottom-left- .datepicker--pointer,.-top-left- .datepicker--pointer{left:10px}.-bottom-right- .datepicker--pointer,.-top-right- .datepicker--pointer{right:10px}.-bottom-center- .datepicker--pointer,.-top-center- .datepicker--pointer{left:calc(50% - 10px / 2)}.-left-top- .datepicker--pointer,.-right-top- .datepicker--pointer{top:10px}.-left-bottom- .datepicker--pointer,.-right-bottom- .datepicker--pointer{bottom:10px}.-left-center- .datepicker--pointer,.-right-center- .datepicker--pointer{top:calc(50% - 10px / 2)}.datepicker--body.active{display:block}.datepicker--nav{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;border-bottom:1px solid #efefef;min-height:32px;padding:4px}.datepicker--nav-action,.datepicker--nav-title{display:-webkit-flex;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.datepicker--nav-action{width:32px;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker--nav-action.-disabled-{visibility:hidden}.datepicker--nav-action svg{width:32px;height:32px}.datepicker--nav-action path{fill:none;stroke:#9c9c9c;stroke-width:2px}.datepicker--nav-title{border-radius:4px;padding:0 8px}.datepicker--nav-title i{font-style:normal;color:#9c9c9c;margin-left:5px}.datepicker--nav-title.-disabled-{cursor:default;background:0 0}.datepicker--buttons{display:-webkit-flex;display:-ms-flexbox;display:flex;padding:4px;border-top:1px solid #efefef}.datepicker--button{color:#4EB5E6;cursor:pointer;border-radius:4px;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:32px}.datepicker--button:hover{color:#4a4a4a;background:#f0f0f0}.datepicker--cell-day.-other-month-,.datepicker--cell-year.-other-decade-{color:#dedede}.datepicker--cell-day.-other-month-:hover,.datepicker--cell-year.-other-decade-:hover{color:#c5c5c5}.-disabled-.datepicker--cell-day.-other-month-:hover,.-disabled-.datepicker--cell-year.-other-decade-:hover{color:#dedede}.-selected-.datepicker--cell-day.-other-month-,.-selected-.datepicker--cell-year.-other-decade-{color:#fff;background:#a2ddf6}.datepicker--cell-day.-other-month-:empty,.datepicker--cell-year.-other-decade-:empty{background:0 0;border:none}
\ No newline at end of file
+.datepicker--cells{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.datepicker--cell{border-radius:4px;cursor:pointer;display:-webkit-flex;display:-ms-flexbox;display:flex;position:relative;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;height:32px;z-index:1}.datepicker--cell.-focus-{background:#f0f0f0}.datepicker--cell.-current-{color:#4EB5E6}.datepicker--cell.-current-.-focus-{color:#4a4a4a}.datepicker--cell.-in-range-{background:#E0F6FF;color:#4a4a4a;padding:2px 0;background-clip:content-box;border-radius:0}.datepicker--cell.-in-range-.-focus-{background-color:#c6efff}.datepicker--cell.-disabled-{cursor:default;color:#aeaeae}.datepicker--cell.-disabled-.-focus-{color:#aeaeae;background:#f0f0f0}.datepicker--cell.-disabled-.-current-:hover{color:#aeaeae}.datepicker--cell.-selected-,.datepicker--cell.-selected-.-current-{color:#fff;background:#5cc4ef}.datepicker--cell.-selected-.-focus-{background:#45bced}.datepicker--cell.-range-from-{border-radius:4px 0 0 4px}.datepicker--cell.-range-to-{border-radius:0 4px 4px 0}.datepicker--cell.-range-from-.-range-to-{border-radius:4px}.datepicker--days-names{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:8px 0 3px}.datepicker--day-name{color:#FF9A19;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex:1;-ms-flex:1;flex:1;text-align:center;text-transform:uppercase;font-size:.8em}.datepicker--body,.datepicker-inline .datepicker--pointer{display:none}.datepicker--cell-day{width:14.28571%}.datepicker--cells-months{height:170px}.datepicker--cell-month{width:33.33%;height:25%}.datepicker--cells-years,.datepicker--years{height:170px}.datepicker--cell-year{width:25%;height:33.33%}.datepickers-container{position:absolute;left:0;top:0}.datepicker{background:#fff;border:1px solid #dbdbdb;box-shadow:0 4px 12px rgba(0,0,0,.15);border-radius:4px;box-sizing:content-box;font-family:Tahoma,sans-serif;font-size:14px;color:#4a4a4a;width:250px;position:absolute;left:-100000px;opacity:0;transition:opacity .3s ease,left 0s .3s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s .3s;transition:opacity .3s ease,transform .3s ease,left 0s .3s,-webkit-transform .3s ease;z-index:100}.datepicker.-from-top-{-webkit-transform:translateY(-8px);transform:translateY(-8px)}.datepicker.-from-right-{-webkit-transform:translateX(8px);transform:translateX(8px)}.datepicker.-from-bottom-{-webkit-transform:translateY(8px);transform:translateY(8px)}.datepicker.-from-left-{-webkit-transform:translateX(-8px);transform:translateX(-8px)}.datepicker.active{opacity:1;-webkit-transform:translate(0);transform:translate(0);transition:opacity .3s ease,left 0s 0s,-webkit-transform .3s ease;transition:opacity .3s ease,transform .3s ease,left 0s 0s;transition:opacity .3s ease,transform .3s ease,left 0s 0s,-webkit-transform .3s ease}.datepicker-inline .datepicker{border-color:#d7d7d7;box-shadow:none;position:static;left:auto;right:auto;opacity:1;-webkit-transform:none;transform:none}.datepicker--content{box-sizing:content-box;padding:4px}.datepicker--pointer{position:absolute;background:#fff;border-top:1px solid #dbdbdb;border-right:1px solid #dbdbdb;width:10px;height:10px;z-index:-1}.datepicker--nav-action:hover,.datepicker--nav-title:hover{background:#f0f0f0}.-top-center- .datepicker--pointer,.-top-left- .datepicker--pointer,.-top-right- .datepicker--pointer{top:calc(100% - 4px);-webkit-transform:rotate(135deg);transform:rotate(135deg)}.-right-bottom- .datepicker--pointer,.-right-center- .datepicker--pointer,.-right-top- .datepicker--pointer{right:calc(100% - 4px);-webkit-transform:rotate(225deg);transform:rotate(225deg)}.-bottom-center- .datepicker--pointer,.-bottom-left- .datepicker--pointer,.-bottom-right- .datepicker--pointer{bottom:calc(100% - 4px);-webkit-transform:rotate(315deg);transform:rotate(315deg)}.-left-bottom- .datepicker--pointer,.-left-center- .datepicker--pointer,.-left-top- .datepicker--pointer{left:calc(100% - 4px);-webkit-transform:rotate(45deg);transform:rotate(45deg)}.-bottom-left- .datepicker--pointer,.-top-left- .datepicker--pointer{left:10px}.-bottom-right- .datepicker--pointer,.-top-right- .datepicker--pointer{right:10px}.-bottom-center- .datepicker--pointer,.-top-center- .datepicker--pointer{left:calc(50% - 10px / 2)}.-left-top- .datepicker--pointer,.-right-top- .datepicker--pointer{top:10px}.-left-bottom- .datepicker--pointer,.-right-bottom- .datepicker--pointer{bottom:10px}.-left-center- .datepicker--pointer,.-right-center- .datepicker--pointer{top:calc(50% - 10px / 2)}.datepicker--body.active{display:block}.datepicker--nav{display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;border-bottom:1px solid #efefef;min-height:32px;padding:4px}.datepicker--nav-action,.datepicker--nav-title{display:-webkit-flex;display:-ms-flexbox;display:flex;cursor:pointer;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.datepicker--nav-action{width:32px;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.datepicker--nav-action.-disabled-{visibility:hidden}.datepicker--nav-action svg{width:32px;height:32px}.datepicker--nav-action path{fill:none;stroke:#9c9c9c;stroke-width:2px}.datepicker--nav-title{border-radius:4px;padding:0 8px}.datepicker--nav-title i{font-style:normal;color:#9c9c9c;margin-left:5px}.datepicker--nav-title.-disabled-{cursor:default;background:0 0}.datepicker--buttons{display:-webkit-flex;display:-ms-flexbox;display:flex;padding:4px;border-top:1px solid #efefef}.datepicker--button{color:#4EB5E6;cursor:pointer;border-radius:4px;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:32px}.datepicker--button:hover{color:#4a4a4a;background:#f0f0f0}.datepicker--cell-day.-other-month-,.datepicker--cell-year.-other-decade-{color:#dedede}.datepicker--cell-day.-other-month-:hover,.datepicker--cell-year.-other-decade-:hover{color:#c5c5c5}.-disabled-.datepicker--cell-day.-other-month-:hover,.-disabled-.datepicker--cell-year.-other-decade-:hover{color:#dedede}.-selected-.datepicker--cell-day.-other-month-,.-selected-.datepicker--cell-year.-other-decade-{color:#fff;background:#a2ddf6}.-selected-.-focus-.datepicker--cell-day.-other-month-,.-selected-.-focus-.datepicker--cell-year.-other-decade-{background:#8ad5f4}.-in-range-.datepicker--cell-day.-other-month-,.-in-range-.datepicker--cell-year.-other-decade-{background-color:#effaff;color:#ccc}.-in-range-.-focus-.datepicker--cell-day.-other-month-,.-in-range-.-focus-.datepicker--cell-year.-other-decade-{background-color:#e5f7ff}.datepicker--cell-day.-other-month-:empty,.datepicker--cell-year.-other-decade-:empty{background:0 0;border:none}
\ No newline at end of file
diff --git a/dist/js/datepicker.js b/dist/js/datepicker.js
index 1e4c6e9..0728d27 100644
--- a/dist/js/datepicker.js
+++ b/dist/js/datepicker.js
@@ -378,7 +378,7 @@ var Datepicker;
this.selectedDates = [date]
}
} else {
- this. selectedDates = [date];
+ this.selectedDates = [date];
}
this._setInputValue();
@@ -950,12 +950,18 @@ var Datepicker;
this.focused = date;
this.silent = false;
+
+ if (this.opts.range && this.selectedDates.length == 1) {
+ this.views[this.currentView]._update();
+ }
},
_onMouseLeaveCell: function (e) {
var $cell = $(e.target).closest('.datepicker--cell'),
date = this._getDateFromCell($cell);
+
$cell.removeClass('-focus-');
+
this.silent = true;
this.focused = '';
this.silent = false;
@@ -985,6 +991,7 @@ var Datepicker;
set date (val) {
if (!(val instanceof Date)) return;
+ this.prevDate = this.currentDate;
this.currentDate = val;
if (this.inited && !this.silent) {
@@ -1181,7 +1188,7 @@ var Datepicker;
},
_bindEvents: function () {
- this.$el.on('click', '.datepicker--cell', $.proxy(this._onClickCell, this));
+ this.$el.on('mouseup', '.datepicker--cell', $.proxy(this._onClickCell, this));
},
_buildBaseHtml: function () {
@@ -1381,10 +1388,23 @@ var Datepicker;
},
_render: function () {
- console.log('render');
this._renderTypes[this.type].bind(this)();
},
+ _update: function () {
+ var $cells = $('.datepicker--cell', this.$cells),
+ _this = this,
+ classes,
+ $cell,
+ date;
+ $cells.each(function (cell, i) {
+ $cell = $(this);
+ date = _this.d._getDateFromCell($(this));
+ classes = _this._getCellContents(date, _this.d.cellType);
+ $cell.attr('class',classes.classes)
+ });
+ },
+
show: function () {
this.$el.addClass('active');
this.acitve = true;
@@ -1408,7 +1428,6 @@ var Datepicker;
this.d.down(new Date(year, month, date));
return;
}
-
// Select date if min view is reached
var selectedDate = new Date(year, month, date),
alreadySelected = this.d._isSelected(selectedDate, this.d.cellType);
diff --git a/dist/js/datepicker.min.js b/dist/js/datepicker.min.js
index 7fe142e..552520e 100644
--- a/dist/js/datepicker.min.js
+++ b/dist/js/datepicker.min.js
@@ -1 +1 @@
-var Datepicker;!function(t,e,s){var i,a,n="datepicker",h=".datepicker-here",r=!1,o='
',c={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,keyboardNav:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",range:!0,todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsFiled:"monthsShort",prevHtml:'',nextHtml:'',navTitles:{days:"MM, yyyy",months:"yyyy",years:"yyyy1 - yyyy2"},onSelect:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},d={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]};Datepicker=function(t,a){this.el=t,this.$el=e(t),this.opts=e.extend(!0,{},c,a,this.$el.data()),i==s&&(i=e("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?e(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.minRange="",this.maxRange="",this.init()},Datepicker.prototype={viewIndexes:["days","months","years"],init:function(){r||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents())),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.views[this.currentView]=new Datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new Datepicker.Navigation(this,this.opts),this.view=this.currentView,this.$datepicker.on("mouseenter",".datepicker--cell",this._onMouseEnterCell.bind(this)),this.$datepicker.on("mouseleave",".datepicker--cell",this._onMouseLeaveCell.bind(this)),this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent,this._onShowEvent.bind(this)),this.$el.on("blur",this._onBlur.bind(this)),this.$el.on("input",this._onInput.bind(this)),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this)),e(t).on("resize",this._onResize.bind(this)),this.opts.keyboardNav&&(this.$el.on("keydown",this._onKeyDown.bind(this)),this.$el.on("keyup",this._onKeyUp.bind(this)),this.$el.on("hotKey",this._onHotKey.bind(this)))},isWeekend:function(t){return-1!==this.opts.weekends.indexOf(t)},_defineLocale:function(t){"string"==typeof t?(this.loc=Datepicker.language[t],this.loc||(console.warn("Can't find language \""+t+'" in Datepicker.language, will use "ru" instead'),this.loc=e.extend(!0,{},Datepicker.language.ru)),this.loc=e.extend(!0,{},Datepicker.language.ru,Datepicker.language[t])):this.loc=e.extend(!0,{},Datepicker.language.ru,t),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay)},_buildDatepickersContainer:function(){r=!0,i.append(''),a=e("#datepickers-container")},_buildBaseHtml:function(){var t,s=e('');t="INPUT"==this.el.nodeName?this.opts.inline?s.insertAfter(this.$el):a:s.appendTo(this.$el),this.$datepicker=e(o).appendTo(t),this.$content=e(".datepicker--content",this.$datepicker),this.$nav=e(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length)return this.opts.onSelect("","",this);var t,e=this.selectedDates,s=Datepicker.getParsedDate(e[0]),i=this,a=new Date(s.year,s.month,s.date);t=e.map(function(t){return i.formatDate(i.loc.dateFormat,t)}).join(this.opts.multipleDatesSeparator),this.opts.multipleDates&&(a=e.map(function(t){var e=Datepicker.getParsedDate(t);return new Date(e.year,e.month,e.date)})),this.opts.onSelect(t,a,this)},next:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month+1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year+1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year+10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},prev:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month-1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year-1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year-10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},formatDate:function(t,e){e=e||this.date;var s=t,i=this.loc,a=Datepicker.getDecade(e),n=Datepicker.getParsedDate(e);switch(!0){case/@/.test(s):s=s.replace(/@/,e.getTime());case/dd/.test(s):s=s.replace(/\bdd\b/,n.fullDate);case/d/.test(s):s=s.replace(/\bd\b/,n.date);case/DD/.test(s):s=s.replace(/\bDD\b/,i.days[n.day]);case/D/.test(s):s=s.replace(/\bD\b/,i.daysShort[n.day]);case/mm/.test(s):s=s.replace(/\bmm\b/,n.fullMonth);case/m/.test(s):s=s.replace(/\bm\b/,n.month+1);case/MM/.test(s):s=s.replace(/\bMM\b/,this.loc.months[n.month]);case/M/.test(s):s=s.replace(/\bM\b/,i.monthsShort[n.month]);case/yyyy/.test(s):s=s.replace(/\byyyy\b/,n.year);case/yyyy1/.test(s):s=s.replace(/\byyyy1\b/,a[0]);case/yyyy2/.test(s):s=s.replace(/\byyyy2\b/,a[1]);case/yy/.test(s):s=s.replace(/\byy\b/,n.year.toString().slice(-2))}return s},selectDate:function(t){var e=this.parsedDate,s=this.selectedDates,i=s.length,a="";if(t instanceof Date){if("days"==this.view&&t.getMonth()!=e.month&&this.opts.moveToOtherMonthsOnSelect&&(a=new Date(t.getFullYear(),t.getMonth(),1)),"years"==this.view&&t.getFullYear()!=e.year&&this.opts.moveToOtherYearsOnSelect&&(a=new Date(t.getFullYear(),0,1)),a&&(this.silent=!0,this.date=a,this.silent=!1,this.nav._render()),this.opts.multipleDates){if(i===this.opts.multipleDates)return;this._isSelected(t)||this.selectedDates.push(t)}else this.opts.range?2==i?this.selectedDates=[t]:1==i?Datepicker.less(this.selectedDates[0],t,this.cellType)?this.selectedDates=[t]:this.selectedDates.push(t):this.selectedDates=[t]:this.selectedDates=[t];this._setInputValue(),this.opts.onSelect&&this._triggerOnChange(),this.opts.autoClose&&this.hide(),this.views[this.currentView]._render()}},removeDate:function(t){var e=this.selectedDates,s=this;if(t instanceof Date)return e.some(function(i,a){return Datepicker.isSame(i,t)?(e.splice(a,1),s.views[s.currentView]._render(),s._setInputValue(),s.opts.onSelect&&s._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date},clear:function(){this.selectedDates=[],this.views[this.currentView]._render(),this.opts.onSelect&&this._triggerOnChange()},update:function(t,s){var i=arguments.length;return 2==i?this.opts[t]=s:1==i&&"object"==typeof t&&(this.opts=e.extend(!0,this.opts,t)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this},_syncWithMinMaxDates:function(){var t=this.date.getTime();this.silent=!0,this.minTime>t&&(this.date=this.minDate),this.maxTime
=this.minTime&&s<=this.maxTime,month:h>=this.minTime&&r<=this.maxTime,year:i.year>=a.year&&i.year<=n.year};return e?o[e]:o.day},_getDimensions:function(t){var e=t.offset();return{width:t.outerWidth(),height:t.outerHeight(),left:e.left,top:e.top}},_getDateFromCell:function(t){var e=this.parsedDate,i=t.data("year")||e.year,a=t.data("month")==s?e.month:t.data("month"),n=t.data("date")||1;return new Date(i,a,n)},_setPositionClasses:function(t){t=t.split(" ");var e=t[0],s=t[1],i="datepicker -"+e+"-"+s+"- -from-"+e+"-";this.visible&&(i+=" active"),this.$datepicker.removeAttr("class").addClass(i)},setPosition:function(t){t=t||this.opts.position;var e,s,i=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=t.split(" "),h=this.opts.offset,r=n[0],o=n[1];switch(r){case"top":e=i.top-a.height-h;break;case"right":s=i.left+i.width+h;break;case"bottom":e=i.top+i.height+h;break;case"left":s=i.left-a.width-h}switch(o){case"top":e=i.top;break;case"right":s=i.left+i.width-a.width;break;case"bottom":e=i.top+i.height-a.height;break;case"left":s=i.left;break;case"center":/left|right/.test(r)?e=i.top+i.height/2-a.height/2:s=i.left+i.width/2-a.width/2}this.$datepicker.css({left:s,top:e})},show:function(){this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0},hide:function(){this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur()},down:function(t){this._changeView(t,"down")},up:function(t){this._changeView(t,"up")},_changeView:function(t,e){t=t||this.focused||this.date;var s="up"==e?this.viewIndex+1:this.viewIndex-1;s>2&&(s=2),0>s&&(s=0),this.silent=!0,this.date=new Date(t.getFullYear(),t.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[s]},_handleHotKey:function(t){var e,s,i,a=Datepicker.getParsedDate(this._getFocusedDate()),n=this.opts,h=!1,r=!1,o=!1,c=a.year,d=a.month,l=a.date;switch(t){case"ctrlRight":case"ctrlUp":d+=1,h=!0;break;case"ctrlLeft":case"ctrlDown":d-=1,h=!0;break;case"shiftRight":case"shiftUp":r=!0,c+=1;break;case"shiftLeft":case"shiftDown":r=!0,c-=1;break;case"altRight":case"altUp":o=!0,c+=10;break;case"altLeft":case"altDown":o=!0,c-=10;break;case"ctrlShiftUp":this.up()}i=Datepicker.getDaysCount(new Date(c,d)),s=new Date(c,d,l),l>i&&(l=i),s.getTime()this.maxTime&&(s=this.maxDate),this.focused=s,e=Datepicker.getParsedDate(s),h&&n.onChangeMonth&&n.onChangeMonth(e.month,e.year),r&&n.onChangeYear&&n.onChangeYear(e.year),o&&n.onChangeDecade&&n.onChangeDecade(this.curDecade)},_registerKey:function(t){var e=this.keys.some(function(e){return e==t});e||this.keys.push(t)},_unRegisterKey:function(t){var e=this.keys.indexOf(t);this.keys.splice(e,1)},_isHotKeyPressed:function(){var t,e=!1,s=this,i=this.keys.sort();for(var a in d)t=d[a],i.length==t.length&&t.every(function(t,e){return t==i[e]})&&(s._trigger("hotKey",a),e=!0);return e},_trigger:function(t,e){this.$el.trigger(t,e)},_focusNextCell:function(t,e){e=e||this.cellType;var s=Datepicker.getParsedDate(this._getFocusedDate()),i=s.year,a=s.month,n=s.date;if(!this._isHotKeyPressed()){switch(t){case 37:"day"==e?n-=1:"","month"==e?a-=1:"","year"==e?i-=1:"";break;case 38:"day"==e?n-=7:"","month"==e?a-=3:"","year"==e?i-=4:"";break;case 39:"day"==e?n+=1:"","month"==e?a+=1:"","year"==e?i+=1:"";break;case 40:"day"==e?n+=7:"","month"==e?a+=3:"","year"==e?i+=4:""}var h=new Date(i,a,n);h.getTime()this.maxTime&&(h=this.maxDate),this.focused=h}},_getFocusedDate:function(){var t=this.focused||this.selectedDates[this.selectedDates.length-1],e=this.parsedDate;if(!t)switch(this.view){case"days":t=new Date(e.year,e.month,(new Date).getDate());break;case"months":t=new Date(e.year,e.month,1);break;case"years":t=new Date(e.year,0,1)}return t},_getCell:function(t,e){e=e||this.cellType;var s,i=Datepicker.getParsedDate(t),a='.datepicker--cell[data-year="'+i.year+'"]';switch(e){case"month":a='[data-month="'+i.month+'"]';break;case"day":a+='[data-month="'+i.month+'"][data-date="'+i.date+'"]'}return s=this.views[this.currentView].$el.find(a),s.length?s:""},_onShowEvent:function(){this.visible||this.show()},_onBlur:function(){},_onMouseDownDatepicker:function(t){this.inFocus=!0},_onMouseUpDatepicker:function(t){this.inFocus=!1,this.$el.focus()},_onInput:function(){var t=this.$el.val();t||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onKeyDown:function(t){var e=t.which;if(this._registerKey(e),e>=37&&40>=e&&(t.preventDefault(),this._focusNextCell(e)),13==e&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var s=this._isSelected(this.focused,this.cellType);s?s&&this.opts.toggleSelected&&this.removeDate(this.focused):this.selectDate(this.focused)}}27==e&&this.hide()},_onKeyUp:function(t){var e=t.which;this._unRegisterKey(e)},_onHotKey:function(t,e){this._handleHotKey(e)},_onMouseEnterCell:function(t){var s=e(t.target).closest(".datepicker--cell"),i=this._getDateFromCell(s);this.silent=!0,this.focused&&(this.focused=""),s.addClass("-focus-"),this.focused=i,this.silent=!1},_onMouseLeaveCell:function(t){var s=e(t.target).closest(".datepicker--cell");this._getDateFromCell(s);s.removeClass("-focus-"),this.silent=!0,this.focused="",this.silent=!1},set focused(t){if(!t&&this.focused){var e=this._getCell(this.focused);e.length&&e.removeClass("-focus-")}this._focused=t,this.silent||(this.date=t)},get focused(){return this._focused},get parsedDate(){return Datepicker.getParsedDate(this.date)},set date(t){return t instanceof Date?(this.currentDate=t,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),t):void 0},get date(){return this.currentDate},set view(t){return this.viewIndex=this.viewIndexes.indexOf(t),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=t,this.inited&&(this.views[t]?this.views[t]._render():this.views[t]=new Datepicker.Body(this,t,this.opts),this.views[this.prevView].hide(),this.views[t].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(t),this.elIsInput&&this.visible&&this.setPosition()),t)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var t=Datepicker.getParsedDate(this.minDate);return new Date(t.year,t.month,t.date).getTime()},get maxTime(){var t=Datepicker.getParsedDate(this.maxDate);return new Date(t.year,t.month,t.date).getTime()},get curDecade(){return Datepicker.getDecade(this.date)}},Datepicker.getDaysCount=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},Datepicker.getParsedDate=function(t){return{year:t.getFullYear(),month:t.getMonth(),fullMonth:t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,date:t.getDate(),fullDate:t.getDate()<10?"0"+t.getDate():t.getDate(),day:t.getDay()}},Datepicker.getDecade=function(t){var e=10*Math.floor(t.getFullYear()/10);return[e,e+9]},Datepicker.template=function(t,e){return t.replace(/#\{([\w]+)\}/g,function(t,s){return e[s]||0===e[s]?e[s]:void 0})},Datepicker.isSame=function(t,e,s){if(!t||!e)return!1;var i=Datepicker.getParsedDate(t),a=Datepicker.getParsedDate(e),n=s?s:"day",h={day:i.date==a.date&&i.month==a.month&&i.year==a.year,month:i.month==a.month&&i.year==a.year,year:i.year==a.year};return h[n]},Datepicker.less=function(t,e,s){return e.getTime()t.getTime()},Datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",firstDay:1}},e.fn[n]=function(t){return Datepicker.prototype[t]?void Datepicker.prototype[t].apply(this.data(n),Array.prototype.slice.call(arguments,1)):this.each(function(){if(e.data(this,n)){var s=e.data(this,n);s.opts=e.extend(!0,s.opts,t),s.update()}else e.data(this,n,new Datepicker(this,t))})},e(function(){e(h).datepicker()})}(window,jQuery),function(){var t={days:'',months:'',years:''},e=Datepicker;e.Body=function(t,e,s){this.d=t,this.type=e,this.opts=s,this.init()},e.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",$.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=$(t[this.type]).appendTo(this.d.$content),this.$names=$(".datepicker--days-names",this.$el),this.$cells=$(".datepicker--cells",this.$el)},_getDayNamesHtml:function(t,e,s,i){return e=void 0!=e?e:t,s=s?s:"",i=void 0!=i?i:0,i>7?s:7==e?this._getDayNamesHtml(t,0,s,++i):(s+=''+this.d.loc.daysMin[e]+"
",this._getDayNamesHtml(t,++e,s,++i))},_getCellContents:function(t,s){var i="datepicker--cell datepicker--cell-"+s,a=new Date,n=this.d,h=e.getParsedDate(t),r={},o=h.date;switch(this.opts.onRenderCell&&(r=this.opts.onRenderCell(t,s)||{},o=r.html?r.html:o,i+=r.classes?" "+r.classes:""),s){case"day":this.d.isWeekend(h.day)&&(i+=" -weekend-"),h.month!=this.d.parsedDate.month&&(i+=" -other-month-",this.opts.selectOtherMonths||(i+=" -disabled-"),this.opts.showOtherMonths||(o=""));break;case"month":o=n.loc[n.opts.monthsFiled][h.month];break;case"year":var c=n.curDecade;(h.yearc[1])&&(i+=" -other-decade-",this.opts.selectOtherYears||(i+=" -disabled-"),this.opts.showOtherYears||(o="")),o=h.year}return this.opts.onRenderCell&&(r=this.opts.onRenderCell(t,s)||{},o=r.html?r.html:o,i+=r.classes?" "+r.classes:""),this.opts.range&&(e.isSame(this.d.selectedDates[0],t)&&(i+=" -range-from-"),e.isSame(this.d.selectedDates[1],t)&&(i+=" -range-to-"),1==this.d.selectedDates.length&&this.d.focused?Datepicker.bigger(this.d.selectedDates[0],t)&&e.less(this.d.focused,t)&&(i+=" -in-range-"):2==this.d.selectedDates.length&&e.bigger(this.d.selectedDates[0],t)&&e.less(this.d.selectedDates[1],t)&&(i+=" -in-range-")),e.isSame(a,t,s)&&(i+=" -current-"),this.d.focused&&e.isSame(t,this.d.focused,s)&&(i+=" -focus-"),this.d._isSelected(t,s)&&(i+=" -selected-"),(!this.d._isInRange(t,s)||r.disabled)&&(i+=" -disabled-"),{html:o,classes:i}},_getDaysHtml:function(t){var s=e.getDaysCount(t),i=new Date(t.getFullYear(),t.getMonth(),1).getDay(),a=new Date(t.getFullYear(),t.getMonth(),s).getDay(),n=i-this.d.loc.firstDay,h=6-a+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var r,o,c=-n+1,d="",l=c,p=s+h;p>=l;l++)o=t.getFullYear(),r=t.getMonth(),d+=this._getDayHtml(new Date(o,r,l));return d},_getDayHtml:function(t){var e=this._getCellContents(t,"day");return''+e.html+"
"},_getMonthsHtml:function(t){for(var s="",i=e.getParsedDate(t),a=0;12>a;)s+=this._getMonthHtml(new Date(i.year,a)),a++;return s},_getMonthHtml:function(t){var e=this._getCellContents(t,"month");return''+e.html+"
"},_getYearsHtml:function(t){var s=(e.getParsedDate(t),e.getDecade(t)),i=s[0]-1,a="",n=i;for(n;n<=s[1]+1;n++)a+=this._getYearHtml(new Date(n,0));return a},_getYearHtml:function(t){var e=this._getCellContents(t,"year");return''+e.html+"
"},_renderTypes:{days:function(){var t=this._getDayNamesHtml(this.d.loc.firstDay),e=this._getDaysHtml(this.d.currentDate);this.$cells.html(e),this.$names.html(t)},months:function(){var t=this._getMonthsHtml(this.d.currentDate);this.$cells.html(t)},years:function(){var t=this._getYearsHtml(this.d.currentDate);this.$cells.html(t)}},_render:function(){console.log("render"),this._renderTypes[this.type].bind(this)()},show:function(){this.$el.addClass("active"),this.acitve=!0},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(t){var e=t.data("date")||1,s=t.data("month")||0,i=t.data("year")||this.d.parsedDate.year;if(this.d.view!=this.opts.minView)return void this.d.down(new Date(i,s,e));var a=new Date(i,s,e),n=this.d._isSelected(a,this.d.cellType);n?n&&this.opts.toggleSelected&&this.d.removeDate(a):this.d.selectDate(a)},_onClickCell:function(t){var e=$(t.target).closest(".datepicker--cell");e.hasClass("-disabled-")||this._handleClick.bind(this)(e)}}}(),function(){var t='#{prevHtml}
#{title}
#{nextHtml}
',e='',s='#{label}';Datepicker.Navigation=function(t,e){this.d=t,this.opts=e,this.$buttonsContainer="",this.init()},Datepicker.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",$.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",$.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",$.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var e=this._getTitle(this.d.currentDate),s=Datepicker.template(t,$.extend({title:e},this.opts));this.d.$nav.html(s),"years"==this.d.view&&$(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(t){return this.d.formatDate(this.opts.navTitles[this.d.view],t)},_addButton:function(t){this.$buttonsContainer.length||this._addButtonsContainer();var e={action:t,label:this.d.loc[t]},i=Datepicker.template(s,e);this.$buttonsContainer.append(i)},_addButtonsContainer:function(){this.d.$datepicker.append(e),this.$buttonsContainer=$(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var t=this.d.parsedDate,e=t.month,s=t.year,i=t.date;switch(this.d.view){case"days":this.d._isInRange(new Date(s,e-1,i),"month")||this._disableNav("prev"),this.d._isInRange(new Date(s,e+1,i),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(s-1,e,i),"year")||this._disableNav("prev"),this.d._isInRange(new Date(s+1,e,i),"year")||this._disableNav("next");break;case"years":this.d._isInRange(new Date(s-10,e,i),"year")||this._disableNav("prev"),this.d._isInRange(new Date(s+10,e,i),"year")||this._disableNav("next")}}},_disableNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(t){var e=$(t.target).closest("[data-action]"),s=e.data("action");this.d[s]()},_onClickNavTitle:function(t){return $(t.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}();
\ No newline at end of file
+var Datepicker;!function(t,e,s){var i,a,n="datepicker",h=".datepicker-here",r=!1,o='',c={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,keyboardNav:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",range:!0,todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsFiled:"monthsShort",prevHtml:'',nextHtml:'',navTitles:{days:"MM, yyyy",months:"yyyy",years:"yyyy1 - yyyy2"},onSelect:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},d={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]};Datepicker=function(t,a){this.el=t,this.$el=e(t),this.opts=e.extend(!0,{},c,a,this.$el.data()),i==s&&(i=e("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?e(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.minRange="",this.maxRange="",this.init()},Datepicker.prototype={viewIndexes:["days","months","years"],init:function(){r||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents())),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.views[this.currentView]=new Datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new Datepicker.Navigation(this,this.opts),this.view=this.currentView,this.$datepicker.on("mouseenter",".datepicker--cell",this._onMouseEnterCell.bind(this)),this.$datepicker.on("mouseleave",".datepicker--cell",this._onMouseLeaveCell.bind(this)),this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent,this._onShowEvent.bind(this)),this.$el.on("blur",this._onBlur.bind(this)),this.$el.on("input",this._onInput.bind(this)),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this)),e(t).on("resize",this._onResize.bind(this)),this.opts.keyboardNav&&(this.$el.on("keydown",this._onKeyDown.bind(this)),this.$el.on("keyup",this._onKeyUp.bind(this)),this.$el.on("hotKey",this._onHotKey.bind(this)))},isWeekend:function(t){return-1!==this.opts.weekends.indexOf(t)},_defineLocale:function(t){"string"==typeof t?(this.loc=Datepicker.language[t],this.loc||(console.warn("Can't find language \""+t+'" in Datepicker.language, will use "ru" instead'),this.loc=e.extend(!0,{},Datepicker.language.ru)),this.loc=e.extend(!0,{},Datepicker.language.ru,Datepicker.language[t])):this.loc=e.extend(!0,{},Datepicker.language.ru,t),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay)},_buildDatepickersContainer:function(){r=!0,i.append(''),a=e("#datepickers-container")},_buildBaseHtml:function(){var t,s=e('');t="INPUT"==this.el.nodeName?this.opts.inline?s.insertAfter(this.$el):a:s.appendTo(this.$el),this.$datepicker=e(o).appendTo(t),this.$content=e(".datepicker--content",this.$datepicker),this.$nav=e(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length)return this.opts.onSelect("","",this);var t,e=this.selectedDates,s=Datepicker.getParsedDate(e[0]),i=this,a=new Date(s.year,s.month,s.date);t=e.map(function(t){return i.formatDate(i.loc.dateFormat,t)}).join(this.opts.multipleDatesSeparator),this.opts.multipleDates&&(a=e.map(function(t){var e=Datepicker.getParsedDate(t);return new Date(e.year,e.month,e.date)})),this.opts.onSelect(t,a,this)},next:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month+1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year+1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year+10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},prev:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month-1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year-1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year-10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},formatDate:function(t,e){e=e||this.date;var s=t,i=this.loc,a=Datepicker.getDecade(e),n=Datepicker.getParsedDate(e);switch(!0){case/@/.test(s):s=s.replace(/@/,e.getTime());case/dd/.test(s):s=s.replace(/\bdd\b/,n.fullDate);case/d/.test(s):s=s.replace(/\bd\b/,n.date);case/DD/.test(s):s=s.replace(/\bDD\b/,i.days[n.day]);case/D/.test(s):s=s.replace(/\bD\b/,i.daysShort[n.day]);case/mm/.test(s):s=s.replace(/\bmm\b/,n.fullMonth);case/m/.test(s):s=s.replace(/\bm\b/,n.month+1);case/MM/.test(s):s=s.replace(/\bMM\b/,this.loc.months[n.month]);case/M/.test(s):s=s.replace(/\bM\b/,i.monthsShort[n.month]);case/yyyy/.test(s):s=s.replace(/\byyyy\b/,n.year);case/yyyy1/.test(s):s=s.replace(/\byyyy1\b/,a[0]);case/yyyy2/.test(s):s=s.replace(/\byyyy2\b/,a[1]);case/yy/.test(s):s=s.replace(/\byy\b/,n.year.toString().slice(-2))}return s},selectDate:function(t){var e=this.parsedDate,s=this.selectedDates,i=s.length,a="";if(t instanceof Date){if("days"==this.view&&t.getMonth()!=e.month&&this.opts.moveToOtherMonthsOnSelect&&(a=new Date(t.getFullYear(),t.getMonth(),1)),"years"==this.view&&t.getFullYear()!=e.year&&this.opts.moveToOtherYearsOnSelect&&(a=new Date(t.getFullYear(),0,1)),a&&(this.silent=!0,this.date=a,this.silent=!1,this.nav._render()),this.opts.multipleDates){if(i===this.opts.multipleDates)return;this._isSelected(t)||this.selectedDates.push(t)}else this.opts.range?2==i?this.selectedDates=[t]:1==i?Datepicker.less(this.selectedDates[0],t,this.cellType)?this.selectedDates=[t]:this.selectedDates.push(t):this.selectedDates=[t]:this.selectedDates=[t];this._setInputValue(),this.opts.onSelect&&this._triggerOnChange(),this.opts.autoClose&&this.hide(),this.views[this.currentView]._render()}},removeDate:function(t){var e=this.selectedDates,s=this;if(t instanceof Date)return e.some(function(i,a){return Datepicker.isSame(i,t)?(e.splice(a,1),s.views[s.currentView]._render(),s._setInputValue(),s.opts.onSelect&&s._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date},clear:function(){this.selectedDates=[],this.views[this.currentView]._render(),this.opts.onSelect&&this._triggerOnChange()},update:function(t,s){var i=arguments.length;return 2==i?this.opts[t]=s:1==i&&"object"==typeof t&&(this.opts=e.extend(!0,this.opts,t)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this},_syncWithMinMaxDates:function(){var t=this.date.getTime();this.silent=!0,this.minTime>t&&(this.date=this.minDate),this.maxTime
=this.minTime&&s<=this.maxTime,month:h>=this.minTime&&r<=this.maxTime,year:i.year>=a.year&&i.year<=n.year};return e?o[e]:o.day},_getDimensions:function(t){var e=t.offset();return{width:t.outerWidth(),height:t.outerHeight(),left:e.left,top:e.top}},_getDateFromCell:function(t){var e=this.parsedDate,i=t.data("year")||e.year,a=t.data("month")==s?e.month:t.data("month"),n=t.data("date")||1;return new Date(i,a,n)},_setPositionClasses:function(t){t=t.split(" ");var e=t[0],s=t[1],i="datepicker -"+e+"-"+s+"- -from-"+e+"-";this.visible&&(i+=" active"),this.$datepicker.removeAttr("class").addClass(i)},setPosition:function(t){t=t||this.opts.position;var e,s,i=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=t.split(" "),h=this.opts.offset,r=n[0],o=n[1];switch(r){case"top":e=i.top-a.height-h;break;case"right":s=i.left+i.width+h;break;case"bottom":e=i.top+i.height+h;break;case"left":s=i.left-a.width-h}switch(o){case"top":e=i.top;break;case"right":s=i.left+i.width-a.width;break;case"bottom":e=i.top+i.height-a.height;break;case"left":s=i.left;break;case"center":/left|right/.test(r)?e=i.top+i.height/2-a.height/2:s=i.left+i.width/2-a.width/2}this.$datepicker.css({left:s,top:e})},show:function(){this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0},hide:function(){this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur()},down:function(t){this._changeView(t,"down")},up:function(t){this._changeView(t,"up")},_changeView:function(t,e){t=t||this.focused||this.date;var s="up"==e?this.viewIndex+1:this.viewIndex-1;s>2&&(s=2),0>s&&(s=0),this.silent=!0,this.date=new Date(t.getFullYear(),t.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[s]},_handleHotKey:function(t){var e,s,i,a=Datepicker.getParsedDate(this._getFocusedDate()),n=this.opts,h=!1,r=!1,o=!1,c=a.year,d=a.month,l=a.date;switch(t){case"ctrlRight":case"ctrlUp":d+=1,h=!0;break;case"ctrlLeft":case"ctrlDown":d-=1,h=!0;break;case"shiftRight":case"shiftUp":r=!0,c+=1;break;case"shiftLeft":case"shiftDown":r=!0,c-=1;break;case"altRight":case"altUp":o=!0,c+=10;break;case"altLeft":case"altDown":o=!0,c-=10;break;case"ctrlShiftUp":this.up()}i=Datepicker.getDaysCount(new Date(c,d)),s=new Date(c,d,l),l>i&&(l=i),s.getTime()this.maxTime&&(s=this.maxDate),this.focused=s,e=Datepicker.getParsedDate(s),h&&n.onChangeMonth&&n.onChangeMonth(e.month,e.year),r&&n.onChangeYear&&n.onChangeYear(e.year),o&&n.onChangeDecade&&n.onChangeDecade(this.curDecade)},_registerKey:function(t){var e=this.keys.some(function(e){return e==t});e||this.keys.push(t)},_unRegisterKey:function(t){var e=this.keys.indexOf(t);this.keys.splice(e,1)},_isHotKeyPressed:function(){var t,e=!1,s=this,i=this.keys.sort();for(var a in d)t=d[a],i.length==t.length&&t.every(function(t,e){return t==i[e]})&&(s._trigger("hotKey",a),e=!0);return e},_trigger:function(t,e){this.$el.trigger(t,e)},_focusNextCell:function(t,e){e=e||this.cellType;var s=Datepicker.getParsedDate(this._getFocusedDate()),i=s.year,a=s.month,n=s.date;if(!this._isHotKeyPressed()){switch(t){case 37:"day"==e?n-=1:"","month"==e?a-=1:"","year"==e?i-=1:"";break;case 38:"day"==e?n-=7:"","month"==e?a-=3:"","year"==e?i-=4:"";break;case 39:"day"==e?n+=1:"","month"==e?a+=1:"","year"==e?i+=1:"";break;case 40:"day"==e?n+=7:"","month"==e?a+=3:"","year"==e?i+=4:""}var h=new Date(i,a,n);h.getTime()this.maxTime&&(h=this.maxDate),this.focused=h}},_getFocusedDate:function(){var t=this.focused||this.selectedDates[this.selectedDates.length-1],e=this.parsedDate;if(!t)switch(this.view){case"days":t=new Date(e.year,e.month,(new Date).getDate());break;case"months":t=new Date(e.year,e.month,1);break;case"years":t=new Date(e.year,0,1)}return t},_getCell:function(t,e){e=e||this.cellType;var s,i=Datepicker.getParsedDate(t),a='.datepicker--cell[data-year="'+i.year+'"]';switch(e){case"month":a='[data-month="'+i.month+'"]';break;case"day":a+='[data-month="'+i.month+'"][data-date="'+i.date+'"]'}return s=this.views[this.currentView].$el.find(a),s.length?s:""},_onShowEvent:function(){this.visible||this.show()},_onBlur:function(){},_onMouseDownDatepicker:function(t){this.inFocus=!0},_onMouseUpDatepicker:function(t){this.inFocus=!1,this.$el.focus()},_onInput:function(){var t=this.$el.val();t||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onKeyDown:function(t){var e=t.which;if(this._registerKey(e),e>=37&&40>=e&&(t.preventDefault(),this._focusNextCell(e)),13==e&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var s=this._isSelected(this.focused,this.cellType);s?s&&this.opts.toggleSelected&&this.removeDate(this.focused):this.selectDate(this.focused)}}27==e&&this.hide()},_onKeyUp:function(t){var e=t.which;this._unRegisterKey(e)},_onHotKey:function(t,e){this._handleHotKey(e)},_onMouseEnterCell:function(t){var s=e(t.target).closest(".datepicker--cell"),i=this._getDateFromCell(s);this.silent=!0,this.focused&&(this.focused=""),s.addClass("-focus-"),this.focused=i,this.silent=!1,this.opts.range&&1==this.selectedDates.length&&this.views[this.currentView]._update()},_onMouseLeaveCell:function(t){var s=e(t.target).closest(".datepicker--cell");this._getDateFromCell(s);s.removeClass("-focus-"),this.silent=!0,this.focused="",this.silent=!1},set focused(t){if(!t&&this.focused){var e=this._getCell(this.focused);e.length&&e.removeClass("-focus-")}this._focused=t,this.silent||(this.date=t)},get focused(){return this._focused},get parsedDate(){return Datepicker.getParsedDate(this.date)},set date(t){return t instanceof Date?(this.prevDate=this.currentDate,this.currentDate=t,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),t):void 0},get date(){return this.currentDate},set view(t){return this.viewIndex=this.viewIndexes.indexOf(t),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=t,this.inited&&(this.views[t]?this.views[t]._render():this.views[t]=new Datepicker.Body(this,t,this.opts),this.views[this.prevView].hide(),this.views[t].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(t),this.elIsInput&&this.visible&&this.setPosition()),t)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var t=Datepicker.getParsedDate(this.minDate);return new Date(t.year,t.month,t.date).getTime()},get maxTime(){var t=Datepicker.getParsedDate(this.maxDate);return new Date(t.year,t.month,t.date).getTime()},get curDecade(){return Datepicker.getDecade(this.date)}},Datepicker.getDaysCount=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},Datepicker.getParsedDate=function(t){return{year:t.getFullYear(),month:t.getMonth(),fullMonth:t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,date:t.getDate(),fullDate:t.getDate()<10?"0"+t.getDate():t.getDate(),day:t.getDay()}},Datepicker.getDecade=function(t){var e=10*Math.floor(t.getFullYear()/10);return[e,e+9]},Datepicker.template=function(t,e){return t.replace(/#\{([\w]+)\}/g,function(t,s){return e[s]||0===e[s]?e[s]:void 0})},Datepicker.isSame=function(t,e,s){if(!t||!e)return!1;var i=Datepicker.getParsedDate(t),a=Datepicker.getParsedDate(e),n=s?s:"day",h={day:i.date==a.date&&i.month==a.month&&i.year==a.year,month:i.month==a.month&&i.year==a.year,year:i.year==a.year};return h[n]},Datepicker.less=function(t,e,s){return e.getTime()t.getTime()},Datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",firstDay:1}},e.fn[n]=function(t){return Datepicker.prototype[t]?void Datepicker.prototype[t].apply(this.data(n),Array.prototype.slice.call(arguments,1)):this.each(function(){if(e.data(this,n)){var s=e.data(this,n);s.opts=e.extend(!0,s.opts,t),s.update()}else e.data(this,n,new Datepicker(this,t))})},e(function(){e(h).datepicker()})}(window,jQuery),function(){var t={days:'',months:'',years:''},e=Datepicker;e.Body=function(t,e,s){this.d=t,this.type=e,this.opts=s,this.init()},e.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("mouseup",".datepicker--cell",$.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=$(t[this.type]).appendTo(this.d.$content),this.$names=$(".datepicker--days-names",this.$el),this.$cells=$(".datepicker--cells",this.$el)},_getDayNamesHtml:function(t,e,s,i){return e=void 0!=e?e:t,s=s?s:"",i=void 0!=i?i:0,i>7?s:7==e?this._getDayNamesHtml(t,0,s,++i):(s+=''+this.d.loc.daysMin[e]+"
",this._getDayNamesHtml(t,++e,s,++i))},_getCellContents:function(t,s){var i="datepicker--cell datepicker--cell-"+s,a=new Date,n=this.d,h=e.getParsedDate(t),r={},o=h.date;switch(this.opts.onRenderCell&&(r=this.opts.onRenderCell(t,s)||{},o=r.html?r.html:o,i+=r.classes?" "+r.classes:""),s){case"day":this.d.isWeekend(h.day)&&(i+=" -weekend-"),h.month!=this.d.parsedDate.month&&(i+=" -other-month-",this.opts.selectOtherMonths||(i+=" -disabled-"),this.opts.showOtherMonths||(o=""));break;case"month":o=n.loc[n.opts.monthsFiled][h.month];break;case"year":var c=n.curDecade;(h.yearc[1])&&(i+=" -other-decade-",this.opts.selectOtherYears||(i+=" -disabled-"),this.opts.showOtherYears||(o="")),o=h.year}return this.opts.onRenderCell&&(r=this.opts.onRenderCell(t,s)||{},o=r.html?r.html:o,i+=r.classes?" "+r.classes:""),this.opts.range&&(e.isSame(this.d.selectedDates[0],t)&&(i+=" -range-from-"),e.isSame(this.d.selectedDates[1],t)&&(i+=" -range-to-"),1==this.d.selectedDates.length&&this.d.focused?Datepicker.bigger(this.d.selectedDates[0],t)&&e.less(this.d.focused,t)&&(i+=" -in-range-"):2==this.d.selectedDates.length&&e.bigger(this.d.selectedDates[0],t)&&e.less(this.d.selectedDates[1],t)&&(i+=" -in-range-")),e.isSame(a,t,s)&&(i+=" -current-"),this.d.focused&&e.isSame(t,this.d.focused,s)&&(i+=" -focus-"),this.d._isSelected(t,s)&&(i+=" -selected-"),(!this.d._isInRange(t,s)||r.disabled)&&(i+=" -disabled-"),{html:o,classes:i}},_getDaysHtml:function(t){var s=e.getDaysCount(t),i=new Date(t.getFullYear(),t.getMonth(),1).getDay(),a=new Date(t.getFullYear(),t.getMonth(),s).getDay(),n=i-this.d.loc.firstDay,h=6-a+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var r,o,c=-n+1,d="",l=c,p=s+h;p>=l;l++)o=t.getFullYear(),r=t.getMonth(),d+=this._getDayHtml(new Date(o,r,l));return d},_getDayHtml:function(t){var e=this._getCellContents(t,"day");return''+e.html+"
"},_getMonthsHtml:function(t){for(var s="",i=e.getParsedDate(t),a=0;12>a;)s+=this._getMonthHtml(new Date(i.year,a)),a++;return s},_getMonthHtml:function(t){var e=this._getCellContents(t,"month");return''+e.html+"
"},_getYearsHtml:function(t){var s=(e.getParsedDate(t),e.getDecade(t)),i=s[0]-1,a="",n=i;for(n;n<=s[1]+1;n++)a+=this._getYearHtml(new Date(n,0));return a},_getYearHtml:function(t){var e=this._getCellContents(t,"year");return''+e.html+"
"},_renderTypes:{days:function(){var t=this._getDayNamesHtml(this.d.loc.firstDay),e=this._getDaysHtml(this.d.currentDate);this.$cells.html(e),this.$names.html(t)},months:function(){var t=this._getMonthsHtml(this.d.currentDate);this.$cells.html(t)},years:function(){var t=this._getYearsHtml(this.d.currentDate);this.$cells.html(t)}},_render:function(){this._renderTypes[this.type].bind(this)()},_update:function(){var t,e,s,i=$(".datepicker--cell",this.$cells),a=this;i.each(function(i,n){e=$(this),s=a.d._getDateFromCell($(this)),t=a._getCellContents(s,a.d.cellType),e.attr("class",t.classes)})},show:function(){this.$el.addClass("active"),this.acitve=!0},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(t){var e=t.data("date")||1,s=t.data("month")||0,i=t.data("year")||this.d.parsedDate.year;if(this.d.view!=this.opts.minView)return void this.d.down(new Date(i,s,e));var a=new Date(i,s,e),n=this.d._isSelected(a,this.d.cellType);n?n&&this.opts.toggleSelected&&this.d.removeDate(a):this.d.selectDate(a)},_onClickCell:function(t){var e=$(t.target).closest(".datepicker--cell");e.hasClass("-disabled-")||this._handleClick.bind(this)(e)}}}(),function(){var t='#{prevHtml}
#{title}
#{nextHtml}
',e='',s='#{label}';Datepicker.Navigation=function(t,e){this.d=t,this.opts=e,this.$buttonsContainer="",this.init()},Datepicker.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",$.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",$.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",$.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var e=this._getTitle(this.d.currentDate),s=Datepicker.template(t,$.extend({title:e},this.opts));this.d.$nav.html(s),"years"==this.d.view&&$(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(t){return this.d.formatDate(this.opts.navTitles[this.d.view],t)},_addButton:function(t){this.$buttonsContainer.length||this._addButtonsContainer();var e={action:t,label:this.d.loc[t]},i=Datepicker.template(s,e);this.$buttonsContainer.append(i)},_addButtonsContainer:function(){this.d.$datepicker.append(e),this.$buttonsContainer=$(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var t=this.d.parsedDate,e=t.month,s=t.year,i=t.date;switch(this.d.view){case"days":this.d._isInRange(new Date(s,e-1,i),"month")||this._disableNav("prev"),this.d._isInRange(new Date(s,e+1,i),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(s-1,e,i),"year")||this._disableNav("prev"),this.d._isInRange(new Date(s+1,e,i),"year")||this._disableNav("next");break;case"years":this.d._isInRange(new Date(s-10,e,i),"year")||this._disableNav("prev"),this.d._isInRange(new Date(s+10,e,i),"year")||this._disableNav("next")}}},_disableNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(t){var e=$(t.target).closest("[data-action]"),s=e.data("action");this.d[s]()},_onClickNavTitle:function(t){return $(t.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}();
\ No newline at end of file
diff --git a/src/js/body.js b/src/js/body.js
index fe2982a..bbe8006 100644
--- a/src/js/body.js
+++ b/src/js/body.js
@@ -33,7 +33,7 @@
},
_bindEvents: function () {
- this.$el.on('click', '.datepicker--cell', $.proxy(this._onClickCell, this));
+ this.$el.on('mouseup', '.datepicker--cell', $.proxy(this._onClickCell, this));
},
_buildBaseHtml: function () {
@@ -233,10 +233,23 @@
},
_render: function () {
- console.log('render');
this._renderTypes[this.type].bind(this)();
},
+ _update: function () {
+ var $cells = $('.datepicker--cell', this.$cells),
+ _this = this,
+ classes,
+ $cell,
+ date;
+ $cells.each(function (cell, i) {
+ $cell = $(this);
+ date = _this.d._getDateFromCell($(this));
+ classes = _this._getCellContents(date, _this.d.cellType);
+ $cell.attr('class',classes.classes)
+ });
+ },
+
show: function () {
this.$el.addClass('active');
this.acitve = true;
@@ -260,7 +273,6 @@
this.d.down(new Date(year, month, date));
return;
}
-
// Select date if min view is reached
var selectedDate = new Date(year, month, date),
alreadySelected = this.d._isSelected(selectedDate, this.d.cellType);
diff --git a/src/js/datepicker.js b/src/js/datepicker.js
index 6e5b63f..8059390 100644
--- a/src/js/datepicker.js
+++ b/src/js/datepicker.js
@@ -378,7 +378,7 @@ var Datepicker;
this.selectedDates = [date]
}
} else {
- this. selectedDates = [date];
+ this.selectedDates = [date];
}
this._setInputValue();
@@ -950,12 +950,18 @@ var Datepicker;
this.focused = date;
this.silent = false;
+
+ if (this.opts.range && this.selectedDates.length == 1) {
+ this.views[this.currentView]._update();
+ }
},
_onMouseLeaveCell: function (e) {
var $cell = $(e.target).closest('.datepicker--cell'),
date = this._getDateFromCell($cell);
+
$cell.removeClass('-focus-');
+
this.silent = true;
this.focused = '';
this.silent = false;
@@ -985,6 +991,7 @@ var Datepicker;
set date (val) {
if (!(val instanceof Date)) return;
+ this.prevDate = this.currentDate;
this.currentDate = val;
if (this.inited && !this.silent) {
diff --git a/src/sass/_datepicker-config.scss b/src/sass/_datepicker-config.scss
index 3277d80..c20d329 100644
--- a/src/sass/_datepicker-config.scss
+++ b/src/sass/_datepicker-config.scss
@@ -13,6 +13,7 @@ $yearsPerRow: 4;
$textColor: (
button: #5cc4ef,
otherMonth: #dedede,
+ otherMonthInRange: #ccc,
disabled: #aeaeae,
currentDate: #4EB5E6,
common: #4a4a4a,
@@ -23,7 +24,10 @@ $textColor: (
$bg: (
selected: #5cc4ef,
selectedHover: darken(#5cc4ef, 5),
- inRange: lighten(#5cc4ef, 15),
+ inRange: #E0F6FF,
+ inRangeHover: darken(#E0F6FF, 5),
+ inRangeOtherMonth: lighten(#E0F6FF, 3),
+ inRangeOtherMonthHover: lighten(#E0F6FF, 1),
hover: #f0f0f0
);
@@ -61,6 +65,18 @@ $transitionOffset: 8px;
&.-selected- {
color: #fff;
background: lighten(map_get($bg, selected), 15);
+ &.-focus- {
+ background: lighten(map_get($bg, selected), 10);
+ }
+ }
+
+ &.-in-range- {
+ background-color: map_get($bg, inRangeOtherMonth);
+ color: darken(map_get($textColor, otherMonth), 7);
+
+ &.-focus- {
+ background-color: map_get($bg, inRangeOtherMonthHover);
+ }
}
&:empty {
diff --git a/src/sass/cell.scss b/src/sass/cell.scss
index d3f8d5b..5f85d0a 100644
--- a/src/sass/cell.scss
+++ b/src/sass/cell.scss
@@ -38,16 +38,19 @@
&.-in-range- {
background: map_get($bg, inRange);
- color: #fff;
+ color: map_get($textColor, common);
padding: 2px 0;
background-clip: content-box;
border-radius: 0;
+
+ &.-focus- {
+ background-color: map_get($bg, inRangeHover);
+ }
}
&.-disabled- {
cursor: default;
color: map_get($textColor, disabled);
- background: none;
&.-focus- {
color: map_get($textColor, disabled);
@@ -81,6 +84,10 @@
&.-range-to- {
border-radius: 0 $datepickerBorderRadius $datepickerBorderRadius 0;
}
+
+ &.-range-from-.-range-to- {
+ border-radius: $datepickerBorderRadius;
+ }
}
// Day names