diff --git a/bower.json b/bower.json index 81d5330..3e1d727 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular-moment-picker", - "version": "0.9.10", + "version": "0.9.11", "authors": [ "Indri Muska " ], diff --git a/dist/angular-moment-picker.css b/dist/angular-moment-picker.css index c88dd1d..e2a7b20 100644 --- a/dist/angular-moment-picker.css +++ b/dist/angular-moment-picker.css @@ -1,4 +1,4 @@ -/*! Angular Moment Picker - v0.9.10 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ +/*! Angular Moment Picker - v0.9.11 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ .moment-picker { position: relative; display: block; diff --git a/dist/angular-moment-picker.js b/dist/angular-moment-picker.js index b42d7f6..19a37b7 100644 --- a/dist/angular-moment-picker.js +++ b/dist/angular-moment-picker.js @@ -1,4 +1,4 @@ -/*! Angular Moment Picker - v0.9.10 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ +/*! Angular Moment Picker - v0.9.11 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -549,10 +549,20 @@ $scope.input .on('focus click', function () { return $scope.$evalAsync($scope.view.open); }) .on('blur', function () { return $scope.$evalAsync($scope.view.close); }) - .on('keydown', function (e) { return $scope.keyboard && $scope.$evalAsync(function () { return $scope.view.keydown(e); }); }); + .on('keydown', function (e) { + if ($scope.keyboard) + $scope.$evalAsync(function () { return $scope.view.keydown(e); }); + }); $scope.contents.on('click', function () { return focusInput(); }); $scope.container.on('mousedown', function (e) { return focusInput(e); }); angular.element(_this.$window).on('resize scroll', $scope.view.position); + // unbind events on destroy + $scope.$on('$destroy', function () { + $scope.input.off('focus click blur keydown'); + $scope.contents.off('click'); + $scope.container.off('mousedown'); + angular.element(_this.$window).off('resize scroll', $scope.view.position); + }); }); }; } diff --git a/dist/angular-moment-picker.min.css b/dist/angular-moment-picker.min.css index 8c8dd6d..9a0d03e 100644 --- a/dist/angular-moment-picker.min.css +++ b/dist/angular-moment-picker.min.css @@ -1,2 +1,2 @@ -/*! Angular Moment Picker - v0.9.10 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ +/*! Angular Moment Picker - v0.9.11 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ .moment-picker{position:relative;display:block}.moment-picker .moment-picker-input{cursor:pointer}.moment-picker .moment-picker-container{color:#404040;min-width:15em;background:#fff;padding:4px;border:1px solid #f0f3f4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;position:absolute;top:100%;margin-top:4px;margin-left:-.5em;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.075);-moz-box-shadow:0 2px 4px rgba(0,0,0,.075);box-shadow:0 2px 4px rgba(0,0,0,.075);z-index:5}.moment-picker .moment-picker-container:after,.moment-picker .moment-picker-container:before{content:"";display:block;width:0;height:0;border:8px solid transparent;border-top:none;position:absolute;top:-9px;left:15px}.moment-picker .moment-picker-container:before{border-bottom-color:#f0f3f4;border-width:9px}.moment-picker .moment-picker-container:after{border-bottom-color:#fff;margin-top:1px;margin-left:1px}.moment-picker .moment-picker-container.inline{position:relative;margin:0}.moment-picker .moment-picker-container.inline:after,.moment-picker .moment-picker-container.inline:before{content:none}.moment-picker.top .moment-picker-container{top:auto;bottom:100%;margin-top:auto;margin-bottom:4px}.moment-picker.top .moment-picker-container:after,.moment-picker.top .moment-picker-container:before{border:8px solid transparent;border-bottom:none;top:auto;bottom:-9px}.moment-picker.top .moment-picker-container:before{border-top-color:#f0f3f4;border-width:9px}.moment-picker.top .moment-picker-container:after{border-top-color:#fff;margin-top:auto;margin-bottom:1px}.moment-picker.right .moment-picker-container{right:0;margin-left:auto;margin-right:-.5em}.moment-picker.right .moment-picker-container:after,.moment-picker.right .moment-picker-container:before{left:auto;right:15px}.moment-picker.right .moment-picker-container:after{margin-left:auto;margin-right:1px}.moment-picker table{border-collapse:collapse;border-spacing:0;min-width:100%;table-layout:fixed}.moment-picker th{font-weight:700}.moment-picker th:first-child,.moment-picker th:last-child{width:2em}.moment-picker td,.moment-picker th{padding:0;text-align:center;min-width:2em;height:2em;text-shadow:0 1px 0 hsla(0,0%,100%,.9);cursor:pointer;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.moment-picker td:hover,.moment-picker th:hover{background-color:#fafbfb;background-image:-webkit-gradient(linear,left top,left bottom,from(#f0f3f4),to(#fafbfb));background-image:-webkit-linear-gradient(#f0f3f4,#fafbfb);background-image:-moz-linear-gradient(#f0f3f4,#fafbfb);background-image:-o-linear-gradient(#f0f3f4,#fafbfb);background-image:linear-gradient(#f0f3f4,#fafbfb)}.moment-picker td.disabled,.moment-picker td.disabled:hover,.moment-picker th.disabled,.moment-picker th.disabled:hover{color:#abbbc7;background:none;cursor:default}.moment-picker td.today{background:#e4eef5;color:#404040;text-shadow:0 1px 0 hsla(0,0%,100%,.9)}.moment-picker td.selected{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.3);border-color:#3ca0dd;background-color:#45b1e8;background-image:-webkit-gradient(linear,left top,left bottom,from(#45b1e8),to(#3097de));background-image:-webkit-linear-gradient(#45b1e8,#3097de);background-image:-moz-linear-gradient(#45b1e8,#3097de);background-image:-o-linear-gradient(#45b1e8,#3097de);background-image:linear-gradient(#45b1e8,#3097de)}.moment-picker td.highlighted{background-image:-webkit-radial-gradient(transparent,rgba(0,0,0,.15));background-image:-moz-radial-gradient(transparent,rgba(0,0,0,.15));background-image:-o-radial-gradient(transparent,rgba(0,0,0,.15));background-image:radial-gradient(transparent,rgba(0,0,0,.15))}.moment-picker .decade-view td,.moment-picker .year-view td{height:3.4em}.moment-picker .month-view .moment-picker-specific-views th{background:none;cursor:default}.moment-picker .month-view td{width:1.42857143em}.moment-picker .day-view td,.moment-picker .hour-view td{height:2.33333333em}.moment-picker .minute-view td{height:1.8em} \ No newline at end of file diff --git a/dist/angular-moment-picker.min.js b/dist/angular-moment-picker.min.js index 5356ada..d48ead7 100644 --- a/dist/angular-moment-picker.min.js +++ b/dist/angular-moment-picker.min.js @@ -1,2 +1,2 @@ -/*! Angular Moment Picker - v0.9.10 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ -!function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){i(8),e.exports=i(4)},function(e,t,i){"use strict";var n=i(2),o=i(3);t.KEYS={up:38,down:40,left:37,right:39,escape:27,enter:13},t.isValidMoment=function(e){return o.isMoment(e)&&e.isValid()},t.toValue=function(e,i,n){var o=e;return t.isValidMoment(e)||(o=t.toMoment(e,i,n)),t.momentToValue(o,i)},t.toMoment=function(e,i,n){var s=o(e,i,n);return t.isValidMoment(s)||(s=void 0),s},t.momentToValue=function(e,i){if(t.isValidMoment(e))return i?e.format(i):e.valueOf()},t.valueToMoment=function(e,t){var i;if(!e)return i;if(i=t.format?o(e,t.format,t.locale):o(e),t.model){var s=t.views.all.slice(0,t.views.all.indexOf(t.detectedMinView));n.forEach(s,function(e){var n=t.views.precisions[e];i[n](t.model[n]())})}return i},t.setValue=function(e,i,n,o){var s=t.isValidMoment(e)?e.clone():t.valueToMoment(e,i),a=t.momentToValue(s,i.format);t.updateMoment(i.model,s,i),t.updateMoment(n.$modelValue,s,i),o.ngModel!=o.momentPicker&&(i.value=a),o.ngModel&&(n.$setViewValue(a),n.$render())},t.updateMoment=function(e,i,o){if(t.isValidMoment(e)&&i){if(!e.isSame(i)){var s=o.views.all.slice(0,o.views.all.indexOf(o.detectedMaxView)+1);n.forEach(s,function(t){var n=o.views.precisions[t];e[n](i[n]())})}}else e=i;return e}},function(e,t){e.exports=angular},function(e,t){e.exports=moment},function(e,t){},function(e,t){e.exports='
'},function(e,t,i){"use strict";var n=i(2),o=i(3),s=i(7),a=i(13),r=i(1),l=i(5),c=function(){function e(e,t,i,c,m,d,u){var h=this;this.$timeout=e,this.$sce=t,this.$log=i,this.$window=c,this.provider=m,this.$compile=d,this.$templateCache=u,this.restrict="AE",this.require="?ngModel",this.transclude=!0,this.template=l,this.scope={value:"=?momentPicker",model:"=?ngModel",locale:"@?",format:"@?",minView:"@?",maxView:"@?",startView:"@?",minDate:"=?",maxDate:"=?",startDate:"=?",disabled:"=?disable",position:"@?",inline:"@?",validate:"=?",autoclose:"=?",setOnSelect:"=?",isOpen:"=?",today:"=?",keyboard:"=?",showHeader:"=?",additions:"=?",change:"&?",selectable:"&?"},this.link=function(e,t,i,l,c){c(function(c){n.forEach(["locale","format","minView","maxView","startView","position","inline","validate","autoclose","setOnSelect","today","keyboard","showHeader","leftArrow","rightArrow","additions"],function(t){n.isDefined(e[t])||(e[t]=h.provider[t]),n.isDefined(i[t])||(i[t]=e[t])}),i.ngModel||(l={}),e.limits={minDate:r.toMoment(e.minDate,e.format,e.locale),maxDate:r.toMoment(e.maxDate,e.format,e.locale),isAfterOrEqualMin:function(t,i){return!n.isDefined(e.limits.minDate)||t.isAfter(e.limits.minDate,i)||t.isSame(e.limits.minDate,i)},isBeforeOrEqualMax:function(t,i){return!n.isDefined(e.limits.maxDate)||t.isBefore(e.limits.maxDate,i)||t.isSame(e.limits.maxDate,i)},isSelectable:function(t,o){var s=!0;try{n.isFunction(e.selectable)&&i.selectable&&(s=e.selectable({date:t,type:o}))}catch(e){h.$log.error(e)}return e.limits.isAfterOrEqualMin(t,o)&&e.limits.isBeforeOrEqualMax(t,o)&&s},checkValue:function(){r.isValidMoment(l.$modelValue)&&e.validate&&(e.limits.isAfterOrEqualMin(l.$modelValue)||r.setValue(e.limits.minDate,e,l,i),e.limits.isBeforeOrEqualMax(l.$modelValue)||r.setValue(e.limits.maxDate,e,l,i))},checkView:function(){n.isDefined(e.view.moment)||(e.view.moment=o().locale(e.locale)),e.limits.isAfterOrEqualMin(e.view.moment)||(e.view.moment=e.limits.minDate.clone()),e.limits.isBeforeOrEqualMax(e.view.moment)||(e.view.moment=e.limits.maxDate.clone()),e.view.update(),e.view.render()}},e.views={all:["decade","year","month","day","hour","minute"],precisions:{decade:"year",year:"month",month:"date",day:"hour",hour:"minute",minute:"second"},formats:{decade:"Y{1,2}(?!Y)|YYYY|[Ll]{1,4}(?!T)",year:"M{1,4}(?![Mo])|Mo|Q",month:"[Dd]{1,4}(?![Ddo])|DDDo|[Dd]o|[Ww]{1,2}(?![Wwo])|[Ww]o|[Ee]|L{1,2}(?!T)|l{1,2}",day:"[Hh]{1,2}|LTS?",hour:"m{1,2}|[Ll]{3,4}|LT(?!S)",minute:"s{1,2}|S{1,}|X|LTS"},detectMinMax:function(){if(e.detectedMinView=e.detectedMaxView=void 0,e.format){var t,i;n.forEach(e.views.formats,function(o,s){var a=new RegExp("("+o+")(?![^[]*])","g");e.format.match(a)&&(n.isDefined(t)||(t=s),i=s)}),t=n.isDefined(t)?Math.max(0,e.views.all.indexOf(t)):0,i=n.isDefined(i)?Math.min(e.views.all.length-1,e.views.all.indexOf(i)):e.views.all.length-1,t>e.views.all.indexOf(e.minView)&&(e.minView=e.views.all[t]),i0&&n>r/2&&e.picker.addClass("top"),o+t.offsetWidth>a&&e.picker.addClass("right")}},keydown:function(t){var i=e.views[e.view.selected],n=e.views.precisions[e.view.selected].replace("date","day"),o=h.provider[n+"sStep"]||1,s=[r.KEYS.up,r.KEYS.left].indexOf(t.keyCode)>=0?"subtract":"add",a=function(t){var a=t?i.perLine:1,r=e.view.moment.clone()[s](o*a,n);e.limits.isSelectable(r,n)&&(e.view.moment=r,e.view.update(),e.view.render())};switch(t.keyCode){case r.KEYS.up:case r.KEYS.down:t.preventDefault(),e.view.isOpen?a(!0):e.view.open();break;case r.KEYS.left:case r.KEYS.right:if(!e.view.isOpen)break;t.preventDefault(),a();break;case r.KEYS.enter:if(!e.view.isOpen)break;e.view.change(n),t.preventDefault();break;case r.KEYS.escape:e.view.toggle()}},unit:function(){return"decade"==e.view.selected?10:1},precision:function(){return e.view.selected.replace("decade","year")},title:"",previous:{label:h.$sce.trustAsHtml(e.leftArrow),selectable:!0,set:function(){e.view.previous.selectable&&(e.view.moment.subtract(e.view.unit(),e.view.precision()),e.view.update(),e.view.render())}},next:{selectable:!0,label:h.$sce.trustAsHtml(e.rightArrow),set:function(){e.view.next.selectable&&(e.view.moment.add(e.view.unit(),e.view.precision()),e.view.update(),e.view.render())}},setParentView:function(){e.view.change(e.views.all[Math.max(0,e.views.all.indexOf(e.view.selected)-1)])},render:function(){var t=e.view.moment.clone().startOf(e.view.precision()).subtract(e.view.unit(),e.view.precision()),i=e.view.moment.clone().endOf(e.view.precision()).add(e.view.unit(),e.view.precision());e.view.previous.selectable=e.limits.isAfterOrEqualMin(t,e.view.precision()),e.view.previous.label=h.$sce.trustAsHtml(e.view.previous.selectable?e.leftArrow:" "),e.view.next.selectable=e.limits.isBeforeOrEqualMax(i,e.view.precision()),e.view.next.label=h.$sce.trustAsHtml(e.view.next.selectable?e.rightArrow:" "),e.view.title=e.views[e.view.selected].render()},change:function(t){var n=e.views.all.indexOf(t),o=e.views.all.indexOf(e.minView),s=e.views.all.indexOf(e.maxView),a=function(){r.setValue(e.view.moment,e,l,i),e.view.update(),i.ngModel&&l.$commitViewValue()};e.setOnSelect&&a(),n<0||n>s?(e.setOnSelect||a(),e.autoclose&&h.$timeout(e.view.close)):n>=o&&(e.view.selected=t)}},e.picker=n.element(t[0].querySelectorAll(".moment-picker")),t.after(e.picker),e.contents=n.element(e.picker[0].querySelectorAll(".moment-picker-contents")),e.container=n.element(e.picker[0].querySelectorAll(".moment-picker-container")),e.contents.append(t.append(c)),e.input="input"!=e.contents[0].tagName.toLowerCase()&&e.contents[0].querySelectorAll("input").length>0?n.element(e.contents[0].querySelectorAll("input")):n.element(e.contents[0]),e.input.addClass("moment-picker-input").attr("tabindex",0),(e.position||"").split(" ").forEach(function(t){return e.picker.addClass(t)}),h.$timeout(function(){n.forEach(e.additions||{},function(t,i){var o=n.element(e.container[0].querySelector(".moment-picker-addition."+i)),s=h.$templateCache.get(t),a=h.$compile(s)(e.$parent);o.append(a)})}),e.views.detectMinMax(),e.limits.checkView(),h.$timeout(function(){i.ngModel&&(!l.$modelValue&&e.value&&l.$setViewValue(e.value),l.$commitViewValue(),l.$render()),e.startDate?e.view.moment=r.toMoment(e.startDate,e.format,e.locale):r.isValidMoment(l.$modelValue)&&(e.view.moment=l.$modelValue.clone()),e.view.update(),e.view.render()}),i.ngModel&&(l.$parsers.push(function(t){return r.updateMoment(l.$modelValue,r.valueToMoment(t,e),e)||!0}),l.$formatters.push(function(t){return r.momentToValue(t,e.format)||""}),l.$viewChangeListeners.push(function(){i.ngModel!=i.momentPicker&&(e.value=l.$viewValue)}),l.$validators.minDate=function(t){return e.validate||!r.isValidMoment(t)||e.limits.isAfterOrEqualMin(t)},l.$validators.maxDate=function(t){return e.validate||!r.isValidMoment(t)||e.limits.isBeforeOrEqualMax(t)}),i.ngModel!=i.momentPicker&&e.$watch("value",function(t,n){t!==n&&r.setValue(t,e,l,i)}),e.$watch(function(){return r.momentToValue(l.$modelValue,e.format)},function(t,s){if(t!=s){var a=r.valueToMoment(t,e);if(r.setValue(a,e,l,i),e.limits.checkValue(),e.view.moment=(a||o().locale(e.locale)).clone(),e.view.update(),e.view.render(),n.isFunction(e.change)&&i.change){var c=r.valueToMoment(s,e);e.$evalAsync(function(){return e.change({newValue:a,oldValue:c})})}}}),e.$watch(function(){return l.$modelValue&&l.$modelValue.valueOf()},function(){var t=(r.isValidMoment(l.$modelValue)?l.$modelValue:o().locale(e.locale)).clone();t.isSame(e.view.moment)||(e.view.moment=t,e.view.update(),e.view.render())}),e.$watch("view.selected",function(){return e.view.render()}),e.$watchGroup(["minView","maxView"],function(){e.views.detectMinMax(),e.startView=e.views.all[Math.max(Math.min(e.views.all.indexOf(e.startView),e.views.all.indexOf(e.maxView)),e.views.all.indexOf(e.minView))],e.view.selected=e.startView}),e.$watchGroup([function(){return r.toValue(e.minDate,e.format,e.locale)},function(){return r.toValue(e.maxDate,e.format,e.locale)}],function(){n.forEach(["minDate","maxDate"],function(t){e.limits[t]=r.toMoment(e[t],e.format,e.locale)}),e.limits.checkValue(),e.limits.checkView(),e.view.render()}),e.$watch(function(){return r.toValue(e.startDate,e.format,e.locale)},function(t,i){t!=i&&(e.view.moment=r.valueToMoment(t,e),e.view.update(),e.view.render())}),i.$observe("locale",function(t){return e.locale=t}),e.$watch("locale",function(t,o){n.isDefined(o)&&t!=o&&(r.isValidMoment(l.$modelValue)&&r.setValue(l.$modelValue.locale(t),e,l,i),r.isValidMoment(e.view.moment)&&(e.view.moment=e.view.moment.locale(t)),r.isValidMoment(e.limits.minDate)&&(e.limits.minDate=e.limits.minDate.locale(t)),r.isValidMoment(e.limits.maxDate)&&(e.limits.maxDate=e.limits.maxDate.locale(t)),e.view.render())}),e.$watch("validate",e.limits.checkValue),e.$watch("isOpen",function(t){e.inline?e.view.isOpen=!0:n.isDefined(t)&&t!=e.view.isOpen&&e.view.toggle()});var m=function(t){t&&t.preventDefault(),e.input[0].focus()};e.input.on("focus click",function(){return e.$evalAsync(e.view.open)}).on("blur",function(){return e.$evalAsync(e.view.close)}).on("keydown",function(t){return e.keyboard&&e.$evalAsync(function(){return e.view.keydown(t)})}),e.contents.on("click",function(){return m()}),e.container.on("mousedown",function(e){return m(e)}),n.element(h.$window).on("resize scroll",e.view.position)})}}return e}();t.__esModule=!0,t.default=c},function(e,t){"use strict";t.getOffset=function(e){if(e){if(!e.getClientRects().length)return{top:0,left:0};var t=function(e){return null!=e&&e===e.window},i=function(e){return t(e)?e:9===e.nodeType&&e.defaultView},n=e.getBoundingClientRect();if(!n.width&&!n.height)return n;var o=e.ownerDocument,s=i(o),a=o.documentElement;return{top:n.top+s.pageYOffset-a.clientTop,left:n.left+s.pageXOffset-a.clientLeft}}}},function(e,t,i){"use strict";var n=i(2),o=i(9);t.Provider=o.default;var s=i(6);t.Directive=s.default,n.module("moment-picker",[]).provider("momentPicker",[function(){return new o.default}]).directive("momentPicker",["$timeout","$sce","$log","$window","momentPicker","$compile","$templateCache",function(e,t,i,n,o,a,r){return new s.default(e,t,i,n,o,a,r)}])},function(e,t,i){"use strict";var n=i(2),o=function(){function e(){this.settings={locale:"en",format:"L LTS",minView:"decade",maxView:"minute",startView:"year",inline:!1,validate:!0,autoclose:!0,setOnSelect:!1,today:!1,keyboard:!1,showHeader:!0,leftArrow:"←",rightArrow:"→",yearsFormat:"YYYY",monthsFormat:"MMM",daysFormat:"D",hoursFormat:"HH:[00]",hoursStart:0,hoursEnd:23,minutesStep:5,minutesStart:0,minutesEnd:59,secondsFormat:"ss",secondsStep:1,secondsStart:0,secondsEnd:59}}return e.prototype.options=function(e){return n.extend(this.settings,e),n.copy(this.settings)},e.prototype.$get=function(){return this.settings},e}();t.__esModule=!0,t.default=o},function(e,t,i){"use strict";var n=i(1),o=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=this.$scope.view.moment.clone().startOf("day").hour(this.provider.hoursStart);this.rows={};for(var t=0;t<=this.provider.hoursEnd-this.provider.hoursStart;t++){var i=Math.floor(t/this.perLine),o=this.$scope.limits.isSelectable(e,"hour");this.rows[i]||(this.rows[i]=[]),this.rows[i].push({index:t,label:e.format(this.provider.hoursFormat),year:e.year(),month:e.month(),date:e.date(),hour:e.hour(),class:[this.$scope.keyboard&&e.isSame(this.$scope.view.moment,"hour")?"highlighted":"",o?n.isValidMoment(this.$ctrl.$modelValue)&&e.isSame(this.$ctrl.$modelValue,"hour")?"selected":"":"disabled"].join(" ").trim(),selectable:o}),e.add(1,"hours")}return this.$scope.view.moment.format("LL")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour),this.$scope.view.update(),this.$scope.view.change("hour"))},e}();t.__esModule=!0,t.default=o},function(e,t,i){"use strict";var n=i(1),o=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=this.$scope.view.moment.clone(),t=10*Math.floor(e.year()/10)-1;this.rows={},e.year(t);for(var i=0;i<12;i++){var o=Math.floor(i/this.perLine),s=this.$scope.limits.isSelectable(e,"year");this.rows[o]||(this.rows[o]=[]),this.rows[o].push({index:e.year(),label:e.format(this.provider.yearsFormat),year:e.year(),class:[this.$scope.keyboard&&e.isSame(this.$scope.view.moment,"year")?"highlighted":"",!s||[0,11].indexOf(i)>=0?"disabled":n.isValidMoment(this.$ctrl.$modelValue)&&e.isSame(this.$ctrl.$modelValue,"year")?"selected":""].join(" ").trim(),selectable:s}),e.add(1,"years")}return[e.subtract(2,"years").format("YYYY"),e.subtract(9,"years").format("YYYY")].reverse().join(" - ")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year),this.$scope.view.update(),this.$scope.view.change("year"))},e}();t.__esModule=!0,t.default=o},function(e,t,i){"use strict";var n=i(2),o=i(3),s=i(1),a=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=0,t=this.$scope.view.moment.clone().startOf("hour").minute(this.provider.minutesStart),i=this.provider.minutesFormat||o.localeData(this.$scope.locale).longDateFormat("LT").replace(/[aA]/,"").trim();this.rows={};for(var n=0;n<=this.provider.minutesEnd-this.provider.minutesStart;n+=this.provider.minutesStep){var a=Math.floor(e/this.perLine),r=this.$scope.limits.isSelectable(t,"minute");this.rows[a]||(this.rows[a]=[]),this.rows[a].push({index:t.minute(),label:t.format(i),year:t.year(),month:t.month(),date:t.date(),hour:t.hour(),minute:t.minute(),class:[this.$scope.keyboard&&t.isSame(this.$scope.view.moment,"minute")?"highlighted":"",r?s.isValidMoment(this.$ctrl.$modelValue)&&t.isSame(this.$ctrl.$modelValue,"minute")?"selected":"":"disabled"].join(" ").trim(),selectable:r}),e++,t.add(this.provider.minutesStep,"minutes")}return this.$scope.keyboard&&this.highlightClosest(),this.$scope.view.moment.clone().startOf("hour").format("lll")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute),this.$scope.view.update(),this.$scope.view.change("minute"))},e.prototype.highlightClosest=function(){var e,t=this,i=[];n.forEach(this.rows,function(e){n.forEach(e,function(e){Math.abs(e.minute-t.$scope.view.moment.minute())Math.abs(i.minute-t.$scope.view.moment.minute())?1:0})[0],e&&e.minute-this.$scope.view.moment.minute()!=0&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute),this.$scope.view.update(),e.selectable&&(e.class=(e.class+" highlighted").trim()))},e}();t.__esModule=!0,t.default=a},function(e,t,i){"use strict";var n=i(11);t.DecadeView=n.default;var o=i(16);t.YearView=o.default;var s=i(15);t.MonthView=s.default;var a=i(10);t.DayView=a.default;var r=i(12);t.HourView=r.default;var l=i(14);t.MinuteView=l.default},function(e,t,i){"use strict";var n=i(2),o=i(1),s=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=6,this.rows={}}return e.prototype.render=function(){var e=0,t=this.$scope.view.moment.clone().startOf("minute").second(this.provider.secondsStart);this.rows={};for(var i=0;i<=this.provider.secondsEnd-this.provider.secondsStart;i+=this.provider.secondsStep){var n=Math.floor(e/this.perLine),s=this.$scope.limits.isSelectable(t,"second");this.rows[n]||(this.rows[n]=[]),this.rows[n].push({index:t.second(),label:t.format(this.provider.secondsFormat),year:t.year(),month:t.month(),date:t.date(),hour:t.hour(),minute:t.minute(),second:t.second(),class:[this.$scope.keyboard&&t.isSame(this.$scope.view.moment,"second")?"highlighted":"",s?o.isValidMoment(this.$ctrl.$modelValue)&&t.isSame(this.$ctrl.$modelValue,"second")?"selected":"":"disabled"].join(" ").trim(),selectable:s}),e++,t.add(this.provider.secondsStep,"seconds")}return this.$scope.keyboard&&this.highlightClosest(),this.$scope.view.moment.clone().startOf("minute").format("lll")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute).second(e.second),this.$scope.view.update(),this.$scope.view.change())},e.prototype.highlightClosest=function(){var e,t=this,i=[];n.forEach(this.rows,function(e){n.forEach(e,function(e){Math.abs(e.second-t.$scope.view.moment.second())Math.abs(i.second-t.$scope.view.moment.second())?1:0})[0],e&&e.second-this.$scope.view.moment.second()!=0&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute).second(e.second),this.$scope.view.update(),e.selectable&&(e.class=(e.class+" highlighted").trim()))},e}();t.__esModule=!0,t.default=s},function(e,t,i){"use strict";var n=i(2),o=i(3),s=i(1),a=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=o.weekdays().length,this.rows=[]}return e.prototype.render=function(){var e=this,t=this.$scope.view.moment.month(),i=this.$scope.view.moment.clone().startOf("month").startOf("week").hour(12),a={},r=i.week(),l=r+5;this.rows=[];for(var c=r;c<=l;c++)a[c]=Array.apply(null,Array(this.perLine)).map(function(){var n=e.$scope.limits.isSelectable(i,"day"),o={index:i.date(),label:i.format(e.provider.daysFormat),year:i.year(),month:i.month(),date:i.date(),class:[e.$scope.keyboard&&i.isSame(e.$scope.view.moment,"day")?"highlighted":"",e.$scope.today&&i.isSame(new Date,"day")?"today":"",n&&i.month()==t?s.isValidMoment(e.$ctrl.$modelValue)&&i.isSame(e.$ctrl.$modelValue,"day")?"selected":"":"disabled"].join(" ").trim(),selectable:n};return i.add(1,"days"),o});return n.forEach(a,function(t){return e.rows.push(t)}),this.headers=o.weekdays().map(function(t,i){return o().locale(e.$scope.locale).startOf("week").add(i,"day").format("dd")}),this.$scope.view.moment.format("MMMM YYYY")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date),this.$scope.view.update(),this.$scope.view.change("day"))},e}();t.__esModule=!0,t.default=a},function(e,t,i){"use strict";var n=i(3),o=i(1),s=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=this,t=this.$scope.view.moment.clone().startOf("year"),i=n.monthsShort();return this.rows={},i.forEach(function(i,n){var s=Math.floor(n/e.perLine),a=e.$scope.limits.isSelectable(t,"month");e.rows[s]||(e.rows[s]=[]),e.rows[s].push({index:t.month(),label:t.format(e.provider.monthsFormat),year:t.year(),month:t.month(),class:[e.$scope.keyboard&&t.isSame(e.$scope.view.moment,"month")?"highlighted":"",a?o.isValidMoment(e.$ctrl.$modelValue)&&t.isSame(e.$ctrl.$modelValue,"month")?"selected":"":"disabled"].join(" ").trim(),selectable:a}),t.add(1,"months")}),this.$scope.view.moment.format("YYYY")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month),this.$scope.view.update(),this.$scope.view.change("month"))},e}();t.__esModule=!0,t.default=s}]); \ No newline at end of file +/*! Angular Moment Picker - v0.9.11 - http://indrimuska.github.io/angular-moment-picker - (c) 2015 Indri Muska - MIT */ +!function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){i(8),e.exports=i(4)},function(e,t,i){"use strict";var n=i(2),o=i(3);t.KEYS={up:38,down:40,left:37,right:39,escape:27,enter:13},t.isValidMoment=function(e){return o.isMoment(e)&&e.isValid()},t.toValue=function(e,i,n){var o=e;return t.isValidMoment(e)||(o=t.toMoment(e,i,n)),t.momentToValue(o,i)},t.toMoment=function(e,i,n){var s=o(e,i,n);return t.isValidMoment(s)||(s=void 0),s},t.momentToValue=function(e,i){if(t.isValidMoment(e))return i?e.format(i):e.valueOf()},t.valueToMoment=function(e,t){var i;if(!e)return i;if(i=t.format?o(e,t.format,t.locale):o(e),t.model){var s=t.views.all.slice(0,t.views.all.indexOf(t.detectedMinView));n.forEach(s,function(e){var n=t.views.precisions[e];i[n](t.model[n]())})}return i},t.setValue=function(e,i,n,o){var s=t.isValidMoment(e)?e.clone():t.valueToMoment(e,i),a=t.momentToValue(s,i.format);t.updateMoment(i.model,s,i),t.updateMoment(n.$modelValue,s,i),o.ngModel!=o.momentPicker&&(i.value=a),o.ngModel&&(n.$setViewValue(a),n.$render())},t.updateMoment=function(e,i,o){if(t.isValidMoment(e)&&i){if(!e.isSame(i)){var s=o.views.all.slice(0,o.views.all.indexOf(o.detectedMaxView)+1);n.forEach(s,function(t){var n=o.views.precisions[t];e[n](i[n]())})}}else e=i;return e}},function(e,t){e.exports=angular},function(e,t){e.exports=moment},function(e,t){},function(e,t){e.exports='
'},function(e,t,i){"use strict";var n=i(2),o=i(3),s=i(7),a=i(13),r=i(1),l=i(5),c=function(){function e(e,t,i,c,m,d,u){var h=this;this.$timeout=e,this.$sce=t,this.$log=i,this.$window=c,this.provider=m,this.$compile=d,this.$templateCache=u,this.restrict="AE",this.require="?ngModel",this.transclude=!0,this.template=l,this.scope={value:"=?momentPicker",model:"=?ngModel",locale:"@?",format:"@?",minView:"@?",maxView:"@?",startView:"@?",minDate:"=?",maxDate:"=?",startDate:"=?",disabled:"=?disable",position:"@?",inline:"@?",validate:"=?",autoclose:"=?",setOnSelect:"=?",isOpen:"=?",today:"=?",keyboard:"=?",showHeader:"=?",additions:"=?",change:"&?",selectable:"&?"},this.link=function(e,t,i,l,c){c(function(c){n.forEach(["locale","format","minView","maxView","startView","position","inline","validate","autoclose","setOnSelect","today","keyboard","showHeader","leftArrow","rightArrow","additions"],function(t){n.isDefined(e[t])||(e[t]=h.provider[t]),n.isDefined(i[t])||(i[t]=e[t])}),i.ngModel||(l={}),e.limits={minDate:r.toMoment(e.minDate,e.format,e.locale),maxDate:r.toMoment(e.maxDate,e.format,e.locale),isAfterOrEqualMin:function(t,i){return!n.isDefined(e.limits.minDate)||t.isAfter(e.limits.minDate,i)||t.isSame(e.limits.minDate,i)},isBeforeOrEqualMax:function(t,i){return!n.isDefined(e.limits.maxDate)||t.isBefore(e.limits.maxDate,i)||t.isSame(e.limits.maxDate,i)},isSelectable:function(t,o){var s=!0;try{n.isFunction(e.selectable)&&i.selectable&&(s=e.selectable({date:t,type:o}))}catch(e){h.$log.error(e)}return e.limits.isAfterOrEqualMin(t,o)&&e.limits.isBeforeOrEqualMax(t,o)&&s},checkValue:function(){r.isValidMoment(l.$modelValue)&&e.validate&&(e.limits.isAfterOrEqualMin(l.$modelValue)||r.setValue(e.limits.minDate,e,l,i),e.limits.isBeforeOrEqualMax(l.$modelValue)||r.setValue(e.limits.maxDate,e,l,i))},checkView:function(){n.isDefined(e.view.moment)||(e.view.moment=o().locale(e.locale)),e.limits.isAfterOrEqualMin(e.view.moment)||(e.view.moment=e.limits.minDate.clone()),e.limits.isBeforeOrEqualMax(e.view.moment)||(e.view.moment=e.limits.maxDate.clone()),e.view.update(),e.view.render()}},e.views={all:["decade","year","month","day","hour","minute"],precisions:{decade:"year",year:"month",month:"date",day:"hour",hour:"minute",minute:"second"},formats:{decade:"Y{1,2}(?!Y)|YYYY|[Ll]{1,4}(?!T)",year:"M{1,4}(?![Mo])|Mo|Q",month:"[Dd]{1,4}(?![Ddo])|DDDo|[Dd]o|[Ww]{1,2}(?![Wwo])|[Ww]o|[Ee]|L{1,2}(?!T)|l{1,2}",day:"[Hh]{1,2}|LTS?",hour:"m{1,2}|[Ll]{3,4}|LT(?!S)",minute:"s{1,2}|S{1,}|X|LTS"},detectMinMax:function(){if(e.detectedMinView=e.detectedMaxView=void 0,e.format){var t,i;n.forEach(e.views.formats,function(o,s){var a=new RegExp("("+o+")(?![^[]*])","g");e.format.match(a)&&(n.isDefined(t)||(t=s),i=s)}),t=n.isDefined(t)?Math.max(0,e.views.all.indexOf(t)):0,i=n.isDefined(i)?Math.min(e.views.all.length-1,e.views.all.indexOf(i)):e.views.all.length-1,t>e.views.all.indexOf(e.minView)&&(e.minView=e.views.all[t]),i0&&n>r/2&&e.picker.addClass("top"),o+t.offsetWidth>a&&e.picker.addClass("right")}},keydown:function(t){var i=e.views[e.view.selected],n=e.views.precisions[e.view.selected].replace("date","day"),o=h.provider[n+"sStep"]||1,s=[r.KEYS.up,r.KEYS.left].indexOf(t.keyCode)>=0?"subtract":"add",a=function(t){var a=t?i.perLine:1,r=e.view.moment.clone()[s](o*a,n);e.limits.isSelectable(r,n)&&(e.view.moment=r,e.view.update(),e.view.render())};switch(t.keyCode){case r.KEYS.up:case r.KEYS.down:t.preventDefault(),e.view.isOpen?a(!0):e.view.open();break;case r.KEYS.left:case r.KEYS.right:if(!e.view.isOpen)break;t.preventDefault(),a();break;case r.KEYS.enter:if(!e.view.isOpen)break;e.view.change(n),t.preventDefault();break;case r.KEYS.escape:e.view.toggle()}},unit:function(){return"decade"==e.view.selected?10:1},precision:function(){return e.view.selected.replace("decade","year")},title:"",previous:{label:h.$sce.trustAsHtml(e.leftArrow),selectable:!0,set:function(){e.view.previous.selectable&&(e.view.moment.subtract(e.view.unit(),e.view.precision()),e.view.update(),e.view.render())}},next:{selectable:!0,label:h.$sce.trustAsHtml(e.rightArrow),set:function(){e.view.next.selectable&&(e.view.moment.add(e.view.unit(),e.view.precision()),e.view.update(),e.view.render())}},setParentView:function(){e.view.change(e.views.all[Math.max(0,e.views.all.indexOf(e.view.selected)-1)])},render:function(){var t=e.view.moment.clone().startOf(e.view.precision()).subtract(e.view.unit(),e.view.precision()),i=e.view.moment.clone().endOf(e.view.precision()).add(e.view.unit(),e.view.precision());e.view.previous.selectable=e.limits.isAfterOrEqualMin(t,e.view.precision()),e.view.previous.label=h.$sce.trustAsHtml(e.view.previous.selectable?e.leftArrow:" "),e.view.next.selectable=e.limits.isBeforeOrEqualMax(i,e.view.precision()),e.view.next.label=h.$sce.trustAsHtml(e.view.next.selectable?e.rightArrow:" "),e.view.title=e.views[e.view.selected].render()},change:function(t){var n=e.views.all.indexOf(t),o=e.views.all.indexOf(e.minView),s=e.views.all.indexOf(e.maxView),a=function(){r.setValue(e.view.moment,e,l,i),e.view.update(),i.ngModel&&l.$commitViewValue()};e.setOnSelect&&a(),n<0||n>s?(e.setOnSelect||a(),e.autoclose&&h.$timeout(e.view.close)):n>=o&&(e.view.selected=t)}},e.picker=n.element(t[0].querySelectorAll(".moment-picker")),t.after(e.picker),e.contents=n.element(e.picker[0].querySelectorAll(".moment-picker-contents")),e.container=n.element(e.picker[0].querySelectorAll(".moment-picker-container")),e.contents.append(t.append(c)),e.input="input"!=e.contents[0].tagName.toLowerCase()&&e.contents[0].querySelectorAll("input").length>0?n.element(e.contents[0].querySelectorAll("input")):n.element(e.contents[0]),e.input.addClass("moment-picker-input").attr("tabindex",0),(e.position||"").split(" ").forEach(function(t){return e.picker.addClass(t)}),h.$timeout(function(){n.forEach(e.additions||{},function(t,i){var o=n.element(e.container[0].querySelector(".moment-picker-addition."+i)),s=h.$templateCache.get(t),a=h.$compile(s)(e.$parent);o.append(a)})}),e.views.detectMinMax(),e.limits.checkView(),h.$timeout(function(){i.ngModel&&(!l.$modelValue&&e.value&&l.$setViewValue(e.value),l.$commitViewValue(),l.$render()),e.startDate?e.view.moment=r.toMoment(e.startDate,e.format,e.locale):r.isValidMoment(l.$modelValue)&&(e.view.moment=l.$modelValue.clone()),e.view.update(),e.view.render()}),i.ngModel&&(l.$parsers.push(function(t){return r.updateMoment(l.$modelValue,r.valueToMoment(t,e),e)||!0}),l.$formatters.push(function(t){return r.momentToValue(t,e.format)||""}),l.$viewChangeListeners.push(function(){i.ngModel!=i.momentPicker&&(e.value=l.$viewValue)}),l.$validators.minDate=function(t){return e.validate||!r.isValidMoment(t)||e.limits.isAfterOrEqualMin(t)},l.$validators.maxDate=function(t){return e.validate||!r.isValidMoment(t)||e.limits.isBeforeOrEqualMax(t)}),i.ngModel!=i.momentPicker&&e.$watch("value",function(t,n){t!==n&&r.setValue(t,e,l,i)}),e.$watch(function(){return r.momentToValue(l.$modelValue,e.format)},function(t,s){if(t!=s){var a=r.valueToMoment(t,e);if(r.setValue(a,e,l,i),e.limits.checkValue(),e.view.moment=(a||o().locale(e.locale)).clone(),e.view.update(),e.view.render(),n.isFunction(e.change)&&i.change){var c=r.valueToMoment(s,e);e.$evalAsync(function(){return e.change({newValue:a,oldValue:c})})}}}),e.$watch(function(){return l.$modelValue&&l.$modelValue.valueOf()},function(){var t=(r.isValidMoment(l.$modelValue)?l.$modelValue:o().locale(e.locale)).clone();t.isSame(e.view.moment)||(e.view.moment=t,e.view.update(),e.view.render())}),e.$watch("view.selected",function(){return e.view.render()}),e.$watchGroup(["minView","maxView"],function(){e.views.detectMinMax(),e.startView=e.views.all[Math.max(Math.min(e.views.all.indexOf(e.startView),e.views.all.indexOf(e.maxView)),e.views.all.indexOf(e.minView))],e.view.selected=e.startView}),e.$watchGroup([function(){return r.toValue(e.minDate,e.format,e.locale)},function(){return r.toValue(e.maxDate,e.format,e.locale)}],function(){n.forEach(["minDate","maxDate"],function(t){e.limits[t]=r.toMoment(e[t],e.format,e.locale)}),e.limits.checkValue(),e.limits.checkView(),e.view.render()}),e.$watch(function(){return r.toValue(e.startDate,e.format,e.locale)},function(t,i){t!=i&&(e.view.moment=r.valueToMoment(t,e),e.view.update(),e.view.render())}),i.$observe("locale",function(t){return e.locale=t}),e.$watch("locale",function(t,o){n.isDefined(o)&&t!=o&&(r.isValidMoment(l.$modelValue)&&r.setValue(l.$modelValue.locale(t),e,l,i),r.isValidMoment(e.view.moment)&&(e.view.moment=e.view.moment.locale(t)),r.isValidMoment(e.limits.minDate)&&(e.limits.minDate=e.limits.minDate.locale(t)),r.isValidMoment(e.limits.maxDate)&&(e.limits.maxDate=e.limits.maxDate.locale(t)),e.view.render())}),e.$watch("validate",e.limits.checkValue),e.$watch("isOpen",function(t){e.inline?e.view.isOpen=!0:n.isDefined(t)&&t!=e.view.isOpen&&e.view.toggle()});var m=function(t){t&&t.preventDefault(),e.input[0].focus()};e.input.on("focus click",function(){return e.$evalAsync(e.view.open)}).on("blur",function(){return e.$evalAsync(e.view.close)}).on("keydown",function(t){e.keyboard&&e.$evalAsync(function(){return e.view.keydown(t)})}),e.contents.on("click",function(){return m()}),e.container.on("mousedown",function(e){return m(e)}),n.element(h.$window).on("resize scroll",e.view.position),e.$on("$destroy",function(){e.input.off("focus click blur keydown"),e.contents.off("click"),e.container.off("mousedown"),n.element(h.$window).off("resize scroll",e.view.position)})})}}return e}();t.__esModule=!0,t.default=c},function(e,t){"use strict";t.getOffset=function(e){if(e){if(!e.getClientRects().length)return{top:0,left:0};var t=function(e){return null!=e&&e===e.window},i=function(e){return t(e)?e:9===e.nodeType&&e.defaultView},n=e.getBoundingClientRect();if(!n.width&&!n.height)return n;var o=e.ownerDocument,s=i(o),a=o.documentElement;return{top:n.top+s.pageYOffset-a.clientTop,left:n.left+s.pageXOffset-a.clientLeft}}}},function(e,t,i){"use strict";var n=i(2),o=i(9);t.Provider=o.default;var s=i(6);t.Directive=s.default,n.module("moment-picker",[]).provider("momentPicker",[function(){return new o.default}]).directive("momentPicker",["$timeout","$sce","$log","$window","momentPicker","$compile","$templateCache",function(e,t,i,n,o,a,r){return new s.default(e,t,i,n,o,a,r)}])},function(e,t,i){"use strict";var n=i(2),o=function(){function e(){this.settings={locale:"en",format:"L LTS",minView:"decade",maxView:"minute",startView:"year",inline:!1,validate:!0,autoclose:!0,setOnSelect:!1,today:!1,keyboard:!1,showHeader:!0,leftArrow:"←",rightArrow:"→",yearsFormat:"YYYY",monthsFormat:"MMM",daysFormat:"D",hoursFormat:"HH:[00]",hoursStart:0,hoursEnd:23,minutesStep:5,minutesStart:0,minutesEnd:59,secondsFormat:"ss",secondsStep:1,secondsStart:0,secondsEnd:59}}return e.prototype.options=function(e){return n.extend(this.settings,e),n.copy(this.settings)},e.prototype.$get=function(){return this.settings},e}();t.__esModule=!0,t.default=o},function(e,t,i){"use strict";var n=i(1),o=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=this.$scope.view.moment.clone().startOf("day").hour(this.provider.hoursStart);this.rows={};for(var t=0;t<=this.provider.hoursEnd-this.provider.hoursStart;t++){var i=Math.floor(t/this.perLine),o=this.$scope.limits.isSelectable(e,"hour");this.rows[i]||(this.rows[i]=[]),this.rows[i].push({index:t,label:e.format(this.provider.hoursFormat),year:e.year(),month:e.month(),date:e.date(),hour:e.hour(),class:[this.$scope.keyboard&&e.isSame(this.$scope.view.moment,"hour")?"highlighted":"",o?n.isValidMoment(this.$ctrl.$modelValue)&&e.isSame(this.$ctrl.$modelValue,"hour")?"selected":"":"disabled"].join(" ").trim(),selectable:o}),e.add(1,"hours")}return this.$scope.view.moment.format("LL")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour),this.$scope.view.update(),this.$scope.view.change("hour"))},e}();t.__esModule=!0,t.default=o},function(e,t,i){"use strict";var n=i(1),o=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=this.$scope.view.moment.clone(),t=10*Math.floor(e.year()/10)-1;this.rows={},e.year(t);for(var i=0;i<12;i++){var o=Math.floor(i/this.perLine),s=this.$scope.limits.isSelectable(e,"year");this.rows[o]||(this.rows[o]=[]),this.rows[o].push({index:e.year(),label:e.format(this.provider.yearsFormat),year:e.year(),class:[this.$scope.keyboard&&e.isSame(this.$scope.view.moment,"year")?"highlighted":"",!s||[0,11].indexOf(i)>=0?"disabled":n.isValidMoment(this.$ctrl.$modelValue)&&e.isSame(this.$ctrl.$modelValue,"year")?"selected":""].join(" ").trim(),selectable:s}),e.add(1,"years")}return[e.subtract(2,"years").format("YYYY"),e.subtract(9,"years").format("YYYY")].reverse().join(" - ")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year),this.$scope.view.update(),this.$scope.view.change("year"))},e}();t.__esModule=!0,t.default=o},function(e,t,i){"use strict";var n=i(2),o=i(3),s=i(1),a=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=0,t=this.$scope.view.moment.clone().startOf("hour").minute(this.provider.minutesStart),i=this.provider.minutesFormat||o.localeData(this.$scope.locale).longDateFormat("LT").replace(/[aA]/,"").trim();this.rows={};for(var n=0;n<=this.provider.minutesEnd-this.provider.minutesStart;n+=this.provider.minutesStep){var a=Math.floor(e/this.perLine),r=this.$scope.limits.isSelectable(t,"minute");this.rows[a]||(this.rows[a]=[]),this.rows[a].push({index:t.minute(),label:t.format(i),year:t.year(),month:t.month(),date:t.date(),hour:t.hour(),minute:t.minute(),class:[this.$scope.keyboard&&t.isSame(this.$scope.view.moment,"minute")?"highlighted":"",r?s.isValidMoment(this.$ctrl.$modelValue)&&t.isSame(this.$ctrl.$modelValue,"minute")?"selected":"":"disabled"].join(" ").trim(),selectable:r}),e++,t.add(this.provider.minutesStep,"minutes")}return this.$scope.keyboard&&this.highlightClosest(),this.$scope.view.moment.clone().startOf("hour").format("lll")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute),this.$scope.view.update(),this.$scope.view.change("minute"))},e.prototype.highlightClosest=function(){var e,t=this,i=[];n.forEach(this.rows,function(e){n.forEach(e,function(e){Math.abs(e.minute-t.$scope.view.moment.minute())Math.abs(i.minute-t.$scope.view.moment.minute())?1:0})[0],e&&e.minute-this.$scope.view.moment.minute()!=0&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute),this.$scope.view.update(),e.selectable&&(e.class=(e.class+" highlighted").trim()))},e}();t.__esModule=!0,t.default=a},function(e,t,i){"use strict";var n=i(11);t.DecadeView=n.default;var o=i(16);t.YearView=o.default;var s=i(15);t.MonthView=s.default;var a=i(10);t.DayView=a.default;var r=i(12);t.HourView=r.default;var l=i(14);t.MinuteView=l.default},function(e,t,i){"use strict";var n=i(2),o=i(1),s=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=6,this.rows={}}return e.prototype.render=function(){var e=0,t=this.$scope.view.moment.clone().startOf("minute").second(this.provider.secondsStart);this.rows={};for(var i=0;i<=this.provider.secondsEnd-this.provider.secondsStart;i+=this.provider.secondsStep){var n=Math.floor(e/this.perLine),s=this.$scope.limits.isSelectable(t,"second");this.rows[n]||(this.rows[n]=[]),this.rows[n].push({index:t.second(),label:t.format(this.provider.secondsFormat),year:t.year(),month:t.month(),date:t.date(),hour:t.hour(),minute:t.minute(),second:t.second(),class:[this.$scope.keyboard&&t.isSame(this.$scope.view.moment,"second")?"highlighted":"",s?o.isValidMoment(this.$ctrl.$modelValue)&&t.isSame(this.$ctrl.$modelValue,"second")?"selected":"":"disabled"].join(" ").trim(),selectable:s}),e++,t.add(this.provider.secondsStep,"seconds")}return this.$scope.keyboard&&this.highlightClosest(),this.$scope.view.moment.clone().startOf("minute").format("lll")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute).second(e.second),this.$scope.view.update(),this.$scope.view.change())},e.prototype.highlightClosest=function(){var e,t=this,i=[];n.forEach(this.rows,function(e){n.forEach(e,function(e){Math.abs(e.second-t.$scope.view.moment.second())Math.abs(i.second-t.$scope.view.moment.second())?1:0})[0],e&&e.second-this.$scope.view.moment.second()!=0&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date).hour(e.hour).minute(e.minute).second(e.second),this.$scope.view.update(),e.selectable&&(e.class=(e.class+" highlighted").trim()))},e}();t.__esModule=!0,t.default=s},function(e,t,i){"use strict";var n=i(2),o=i(3),s=i(1),a=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=o.weekdays().length,this.rows=[]}return e.prototype.render=function(){var e=this,t=this.$scope.view.moment.month(),i=this.$scope.view.moment.clone().startOf("month").startOf("week").hour(12),a={},r=i.week(),l=r+5;this.rows=[];for(var c=r;c<=l;c++)a[c]=Array.apply(null,Array(this.perLine)).map(function(){var n=e.$scope.limits.isSelectable(i,"day"),o={index:i.date(),label:i.format(e.provider.daysFormat),year:i.year(),month:i.month(),date:i.date(),class:[e.$scope.keyboard&&i.isSame(e.$scope.view.moment,"day")?"highlighted":"",e.$scope.today&&i.isSame(new Date,"day")?"today":"",n&&i.month()==t?s.isValidMoment(e.$ctrl.$modelValue)&&i.isSame(e.$ctrl.$modelValue,"day")?"selected":"":"disabled"].join(" ").trim(),selectable:n};return i.add(1,"days"),o});return n.forEach(a,function(t){return e.rows.push(t)}),this.headers=o.weekdays().map(function(t,i){return o().locale(e.$scope.locale).startOf("week").add(i,"day").format("dd")}),this.$scope.view.moment.format("MMMM YYYY")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month).date(e.date),this.$scope.view.update(),this.$scope.view.change("day"))},e}();t.__esModule=!0,t.default=a},function(e,t,i){"use strict";var n=i(3),o=i(1),s=function(){function e(e,t,i){this.$scope=e,this.$ctrl=t,this.provider=i,this.perLine=4,this.rows={}}return e.prototype.render=function(){var e=this,t=this.$scope.view.moment.clone().startOf("year"),i=n.monthsShort();return this.rows={},i.forEach(function(i,n){var s=Math.floor(n/e.perLine),a=e.$scope.limits.isSelectable(t,"month");e.rows[s]||(e.rows[s]=[]),e.rows[s].push({index:t.month(),label:t.format(e.provider.monthsFormat),year:t.year(),month:t.month(),class:[e.$scope.keyboard&&t.isSame(e.$scope.view.moment,"month")?"highlighted":"",a?o.isValidMoment(e.$ctrl.$modelValue)&&t.isSame(e.$ctrl.$modelValue,"month")?"selected":"":"disabled"].join(" ").trim(),selectable:a}),t.add(1,"months")}),this.$scope.view.moment.format("YYYY")},e.prototype.set=function(e){e.selectable&&(this.$scope.view.moment.year(e.year).month(e.month),this.$scope.view.update(),this.$scope.view.change("month"))},e}();t.__esModule=!0,t.default=s}]); \ No newline at end of file diff --git a/package.json b/package.json index ccb6f68..87f709b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-moment-picker", - "version": "0.9.10", + "version": "0.9.11", "description": "Angular Moment Picker is an AngularJS directive for date and time picker using Moment.js", "main": "dist/angular-moment-picker.js", "repository": { diff --git a/src/directive.ts b/src/directive.ts index d240b57..7f52b70 100644 --- a/src/directive.ts +++ b/src/directive.ts @@ -410,7 +410,7 @@ export default class Directive implements ng.IDirective { .on('focus click', () => $scope.$evalAsync($scope.view.open)) .on('blur', () => $scope.$evalAsync($scope.view.close)) .on('keydown', (e) => { - if ($scope.keyboard) $scope.$evalAsync(() => $scope.view.keydown(e)) + if ($scope.keyboard) $scope.$evalAsync(() => $scope.view.keydown(e)); }); $scope.contents.on('click', () => focusInput()); $scope.container.on('mousedown', (e: JQueryEventObject) => focusInput(e));