diff --git a/dist/mdPickers.js b/dist/mdPickers.js index 372c76bb..7d0b26cb 100644 --- a/dist/mdPickers.js +++ b/dist/mdPickers.js @@ -223,20 +223,23 @@ module.provider("$mdpDatePicker", function() { function CalendarCtrl($scope) { var self = this; - this.dow = moment.localeData().firstDayOfWeek(); - - this.weekDays = [].concat( - moment.weekdaysMin().slice( - this.dow - ), - moment.weekdaysMin().slice( - 0, - this.dow - ) - ); - - this.daysInMonth = []; - + + this.$onInit = function () { + self.daysInMonth = []; + self.dow = moment.localeData().firstDayOfWeek(); + self.weekDays = [].concat( + moment.weekdaysMin().slice(self.dow), + moment.weekdaysMin().slice(0, self.dow) + ); + $scope.$watch(function () { + return self.date.unix() + }, function (newValue, oldValue) { + if (newValue && newValue !== oldValue) + self.updateDaysInMonth(); + }); + self.updateDaysInMonth(); + }; + this.getDaysInMonth = function() { var days = self.date.daysInMonth(), firstDay = moment(self.date).date(1).day() - this.dow; @@ -280,13 +283,11 @@ function CalendarCtrl($scope) { this.updateDaysInMonth = function() { self.daysInMonth = self.getDaysInMonth(); }; - + $scope.$watch(function() { return self.date.unix() }, function(newValue, oldValue) { if(newValue && newValue !== oldValue) self.updateDaysInMonth(); - }) - - self.updateDaysInMonth(); + }); } module.directive("mdpCalendar", ["$animate", function($animate) { @@ -616,21 +617,34 @@ function TimePickerCtrl($scope, $mdDialog, time, autoSwitch, $mdMedia) { } function ClockCtrl($scope) { + var self = this; var TYPE_HOURS = "hours"; var TYPE_MINUTES = "minutes"; - var self = this; - - this.STEP_DEG = 360 / 12; - this.steps = []; - - this.CLOCK_TYPES = { - "hours": { - range: 12, - }, - "minutes": { - range: 60, + + this.$onInit = function () { + self.STEP_DEG = 360 / 12; + self.steps = []; + self.CLOCK_TYPES = { + "hours": { range: 12, }, + "minutes": { range: 60, } + }; + self.type = self.type || "hours"; + switch (self.type) { + case TYPE_HOURS: + for (var i = 1; i <= 12; i++) + self.steps.push(i); + self.selected = self.time.hours() || 0; + if (self.selected > 12) self.selected -= 12; + + break; + case TYPE_MINUTES: + for (var i = 5; i <= 55; i += 5) + self.steps.push(i); + self.steps.push(0); + self.selected = self.time.minutes() || 0; + break; } - } + }; this.getPointerStyle = function() { var divider = 1; @@ -682,28 +696,6 @@ function ClockCtrl($scope) { } }; - - this.init = function() { - self.type = self.type || "hours"; - switch(self.type) { - case TYPE_HOURS: - for(var i = 1; i <= 12; i++) - self.steps.push(i); - self.selected = self.time.hours() || 0; - if(self.selected > 12) self.selected -= 12; - - break; - case TYPE_MINUTES: - for(var i = 5; i <= 55; i+=5) - self.steps.push(i); - self.steps.push(0); - self.selected = self.time.minutes() || 0; - - break; - } - }; - - this.init(); } module.directive("mdpClock", ["$animate", "$timeout", function($animate, $timeout) { diff --git a/dist/mdPickers.min.js b/dist/mdPickers.min.js index 28b299ec..dfb15469 100644 --- a/dist/mdPickers.min.js +++ b/dist/mdPickers.min.js @@ -1,2 +1,2 @@ -!function(){"use strict";function t(t,e,a,i,n,r){var o=this;this.date=moment(n),this.minDate=r.minDate&&moment(r.minDate).isValid()?moment(r.minDate):null,this.maxDate=r.maxDate&&moment(r.maxDate).isValid()?moment(r.maxDate):null,this.displayFormat=r.displayFormat||"ddd, MMM DD",this.dateFilter=angular.isFunction(r.dateFilter)?r.dateFilter:null,this.selectingYear=!1,this.minDate&&this.maxDate&&this.maxDate.isBefore(this.minDate)&&(this.maxDate=moment(this.minDate).add(1,"days")),this.date&&(this.minDate&&this.date.isBefore(this.minDate)&&(this.date=moment(this.minDate)),this.maxDate&&this.date.isAfter(this.maxDate)&&(this.date=moment(this.maxDate))),this.yearItems={currentIndex_:0,PAGE_SIZE:5,START:o.minDate?o.minDate.year():1900,END:o.maxDate?o.maxDate.year():0,getItemAtIndex:function(t){return this.currentIndex_a&&(a=this.weekDays.length-1);for(var i=[],n=1;a+t>=n;n++){var r=null;n>a&&(r={value:n-a,enabled:e.isDayEnabled(moment(e.date).date(n-a).toDate())}),i.push(r)}return i},this.isDayEnabled=function(t){return!(this.minDate&&!(this.minDate<=t)||this.maxDate&&!(this.maxDate>=t)||e.dateFilter&&e.dateFilter(t))},this.selectDate=function(t){e.date.date(t)},this.nextMonth=function(){e.date.add(1,"months")},this.prevMonth=function(){e.date.subtract(1,"months")},this.updateDaysInMonth=function(){e.daysInMonth=e.getDaysInMonth()},t.$watch(function(){return e.date.unix()},function(t,a){t&&t!==a&&e.updateDaysInMonth()}),e.updateDaysInMonth()}function a(t,e){return!t||angular.isDate(t)||moment(t,e,!0).isValid()}function i(t,e,a){var a=moment(a,"YYYY-MM-DD",!0),i=angular.isDate(t)?moment(t):moment(t,e,!0);return!t||angular.isDate(t)||!a.isValid()||i.isSameOrAfter(a)}function n(t,e,a){var a=moment(a,"YYYY-MM-DD",!0),i=angular.isDate(t)?moment(t):moment(t,e,!0);return!t||angular.isDate(t)||!a.isValid()||i.isSameOrBefore(a)}function r(t,e,a){var i=angular.isDate(t)?moment(t):moment(t,e,!0);return!t||angular.isDate(t)||!angular.isFunction(a)||!a(i)}function o(t,e,a,i,n){var r=this;this.VIEW_HOURS=1,this.VIEW_MINUTES=2,this.currentView=this.VIEW_HOURS,this.time=moment(a),this.autoSwitch=!!i,this.clockHours=parseInt(this.time.format("h")),this.clockMinutes=parseInt(this.time.minutes()),t.$mdMedia=n,this.switchView=function(){r.currentView=r.currentView==r.VIEW_HOURS?r.VIEW_MINUTES:r.VIEW_HOURS},this.setAM=function(){r.time.hours()>=12&&r.time.hour(r.time.hour()-12)},this.setPM=function(){r.time.hours()<12&&r.time.hour(r.time.hour()+12)},this.cancel=function(){e.cancel()},this.confirm=function(){e.hide(this.time.toDate())}}function s(t){var e="hours",a="minutes",i=this;this.STEP_DEG=30,this.steps=[],this.CLOCK_TYPES={hours:{range:12},minutes:{range:60}},this.getPointerStyle=function(){var t=1;switch(i.type){case e:t=12;break;case a:t=60}var n=Math.round(i.selected*(360/t))-180;return{"-webkit-transform":"rotate("+n+"deg)","-ms-transform":"rotate("+n+"deg)",transform:"rotate("+n+"deg)"}},this.setTimeByDeg=function(t){t=t>=360?0:t;var n=0;switch(i.type){case e:n=12;break;case a:n=60}i.setTime(Math.round(n/360*t))},this.setTime=function(t,n){switch(this.selected=t,i.type){case e:"PM"==i.time.format("A")&&(t+=12),this.time.hours(t);break;case a:t>59&&(t-=60),this.time.minutes(t)}},this.init=function(){switch(i.type=i.type||"hours",i.type){case e:for(var t=1;12>=t;t++)i.steps.push(t);i.selected=i.time.hours()||0,i.selected>12&&(i.selected-=12);break;case a:for(var t=5;55>=t;t+=5)i.steps.push(t);i.steps.push(0),i.selected=i.time.minutes()||0}},this.init()}var d=angular.module("mdPickers",["ngMaterial","ngAnimate","ngAria"]);d.config(["$mdIconProvider","mdpIconsRegistry",function(t,e){angular.forEach(e,function(e,a){t.icon(e.id,e.url)})}]),d.run(["$templateCache","mdpIconsRegistry",function(t,e){angular.forEach(e,function(e,a){t.put(e.url,e.svg)})}]),d.constant("mdpIconsRegistry",[{id:"mdp-chevron-left",url:"mdp-chevron-left.svg",svg:''},{id:"mdp-chevron-right",url:"mdp-chevron-right.svg",svg:''},{id:"mdp-access-time",url:"mdp-access-time.svg",svg:''},{id:"mdp-event",url:"mdp-event.svg",svg:''}]),d.directive("ngMessage",["$mdUtil",function(t){return{restrict:"EA",priority:101,compile:function(e){var a=t.getClosest(e,"mdp-time-picker",!0)||t.getClosest(e,"mdp-date-picker",!0);if(a)return e.toggleClass("md-input-message-animation",!0),{}}}}]),d.provider("$mdpDatePicker",function(){var e="OK",a="Cancel",i="ddd, MMM DD";this.setDisplayFormat=function(t){i=t},this.setOKButtonLabel=function(t){e=t},this.setCancelButtonLabel=function(t){a=t},this.$get=["$mdDialog",function(n){var r=function(r,o){return angular.isDate(r)||(r=Date.now()),angular.isObject(o)||(o={}),o.displayFormat=i,n.show({controller:["$scope","$mdDialog","$mdMedia","$timeout","currentDate","options",t],controllerAs:"datepicker",clickOutsideToClose:!0,template:'
{{ datepicker.date.format(\'YYYY\') }}{{ datepicker.date.format(datepicker.displayFormat) }}
{{ item }}
'+a+''+e+"
",targetEvent:o.targetEvent,locals:{currentDate:r,options:o},skipHide:!0})};return r}]}),d.directive("mdpCalendar",["$animate",function(t){return{restrict:"E",bindToController:{date:"=",minDate:"=",maxDate:"=",dateFilter:"="},template:'
{{ calendar.date.format("MMMM YYYY") }}
{{ d }}
{{ day.value }}
',controller:["$scope",e],controllerAs:"calendar",link:function(e,a,i,n){var r=[a[0].querySelector(".mdp-calendar-week-days"),a[0].querySelector(".mdp-calendar-days"),a[0].querySelector(".mdp-calendar-monthyear")].map(function(t){return angular.element(t)});e.$watch(function(){return n.date.format("YYYYMM")},function(e,a){var i=null;if(e>a?i="mdp-animate-next":a>e&&(i="mdp-animate-prev"),i)for(var n in r)r[n].addClass(i),t.removeClass(r[n],i)})}}}]),d.directive("mdpDatePicker",["$mdpDatePicker","$timeout",function(t,e){return{restrict:"E",require:"ngModel",transclude:!0,template:function(t,e){var a=angular.isDefined(e.mdpNoFloat),i=angular.isDefined(e.mdpPlaceholder)?e.mdpPlaceholder:"",n=angular.isDefined(e.mdpOpenOnClick)?!0:!1;return'
"},scope:{minDate:"=mdpMinDate",maxDate:"=mdpMaxDate",dateFilter:"=mdpDateFilter",dateFormat:"@mdpFormat",placeholder:"@mdpPlaceholder",noFloat:"=mdpNoFloat",openOnClick:"=mdpOpenOnClick",disabled:"=?mdpDisabled"},link:{pre:function(t,e,a,i,n){},post:function(e,o,s,d,m){function c(t){p[0].value=t,g.setHasValue(!d.$isEmpty(t))}function l(t){var a=moment(t,angular.isDate(t)?null:e.dateFormat,!0),i=a.format(e.dateFormat);a.isValid()?(c(i),d.$setViewValue(i)):(c(t),d.$setViewValue(t)),!d.$pristine&&f.hasClass("md-auto-hide")&&h.hasClass("md-input-invalid")&&f.removeClass("md-auto-hide"),d.$render()}function u(t){t.target.value!==d.$viewVaue&&l(t.target.value)}var p=angular.element(o[0].querySelector("input")),h=angular.element(o[0].querySelector("md-input-container")),g=h.controller("mdInputContainer");m(function(t){h.append(t)});var f=angular.element(h[0].querySelector("[ng-messages]"));e.type=e.dateFormat?"text":"date",e.dateFormat=e.dateFormat||"YYYY-MM-DD",e.model=d,e.isError=function(){return!d.$pristine&&!!d.$invalid},d.$formatters.unshift(function(t){var a=angular.isDate(t)&&moment(t);c(a&&a.isValid()?a.format(e.dateFormat):null)}),d.$validators.format=function(t,i){return a(i,e.dateFormat)},d.$validators.minDate=function(t,a){return i(a,e.dateFormat,e.minDate)},d.$validators.maxDate=function(t,a){return n(a,e.dateFormat,e.maxDate)},d.$validators.filter=function(t,a){return r(a,e.dateFormat,e.dateFilter)},d.$validators.required=function(t,e){return angular.isUndefined(s.required)||!d.$isEmpty(t)||!d.$isEmpty(e)},d.$parsers.unshift(function(t){var a=moment(t,e.dateFormat,!0);if(a.isValid()){if(angular.isDate(d.$modelValue)){var i=moment(d.$modelValue);i.year(a.year()),i.month(a.month()),i.date(a.date()),a=i}return a.toDate()}return null}),e.showPicker=function(a){t(d.$modelValue,{minDate:e.minDate,maxDate:e.maxDate,dateFilter:e.dateFilter,targetEvent:a}).then(l)},p.on("reset input blur",u),e.$on("$destroy",function(){p.off("reset input blur",u)})}}}}]),d.directive("mdpDatePicker",["$mdpDatePicker","$timeout",function(t,e){return{restrict:"A",require:"ngModel",scope:{minDate:"@min",maxDate:"@max",dateFilter:"=mdpDateFilter",dateFormat:"@mdpFormat"},link:function(e,o,s,d,m){function c(a){t(d.$modelValue,{minDate:e.minDate,maxDate:e.maxDate,dateFilter:e.dateFilter,targetEvent:a}).then(function(t){d.$setViewValue(moment(t).format(e.format)),d.$render()})}e.dateFormat=e.dateFormat||"YYYY-MM-DD",d.$validators.format=function(t,i){return a(i,e.format)},d.$validators.minDate=function(t,a){return i(a,e.format,e.minDate)},d.$validators.maxDate=function(t,a){return n(a,e.format,e.maxDate)},d.$validators.filter=function(t,a){return r(a,e.format,e.dateFilter)},o.on("click",c),e.$on("$destroy",function(){o.off("click",c)})}}}]),d.directive("mdpClock",["$animate","$timeout",function(t,e){return{restrict:"E",bindToController:{type:"@?",time:"=",autoSwitch:"=?"},replace:!0,template:'
{{ step }}
',controller:["$scope",s],controllerAs:"clock",link:function(t,a,i,n){var r=(angular.element(a[0].querySelector(".mdp-pointer")),t.$parent.timepicker),o=function(t){var a=t.currentTarget.getClientRects()[0],i=t.currentTarget.offsetWidth/2-(t.pageX-a.left),o=t.pageY-a.top-t.currentTarget.offsetHeight/2,s=Math.round(Math.atan2(i,o)*(180/Math.PI));e(function(){n.setTimeByDeg(s+180),n.autoSwitch&&-1!==["mouseup","click"].indexOf(t.type)&&r&&r.switchView()})};a.on("mousedown",function(){a.on("mousemove",o)}),a.on("mouseup",function(t){a.off("mousemove")}),a.on("click",o),t.$on("$destroy",function(){a.off("click",o),a.off("mousemove",o)})}}}]),d.provider("$mdpTimePicker",function(){var t="OK",e="Cancel";this.setOKButtonLabel=function(e){t=e},this.setCancelButtonLabel=function(t){e=t},this.$get=["$mdDialog",function(a){var i=function(i,n){return angular.isDate(i)||(i=Date.now()),angular.isObject(n)||(n={}),a.show({controller:["$scope","$mdDialog","time","autoSwitch","$mdMedia",o],controllerAs:"timepicker",clickOutsideToClose:!0,template:'
{{ timepicker.time.format("h") }}:{{ timepicker.time.format("mm") }}
AMPM
'+e+''+t+"
",targetEvent:n.targetEvent,locals:{time:i,autoSwitch:n.autoSwitch},skipHide:!0})};return i}]}),d.directive("mdpTimePicker",["$mdpTimePicker","$timeout",function(t,e){return{restrict:"E",require:"ngModel",transclude:!0,template:function(t,e){var a=angular.isDefined(e.mdpNoFloat),i=angular.isDefined(e.mdpPlaceholder)?e.mdpPlaceholder:"",n=angular.isDefined(e.mdpOpenOnClick)?!0:!1;return'
"},scope:{timeFormat:"@mdpFormat",placeholder:"@mdpPlaceholder",autoSwitch:"=?mdpAutoSwitch",disabled:"=?mdpDisabled"},link:function(e,a,i,n,r){function o(t){m[0].value=t,l.setHasValue(!n.$isEmpty(t))}function s(t){var a=moment(t,angular.isDate(t)?null:e.timeFormat,!0),i=a.format(e.timeFormat);a.isValid()?(o(i),n.$setViewValue(i)):(o(t),n.$setViewValue(t)),!n.$pristine&&u.hasClass("md-auto-hide")&&c.hasClass("md-input-invalid")&&u.removeClass("md-auto-hide"),n.$render()}function d(t){t.target.value!==n.$viewVaue&&s(t.target.value)}var m=angular.element(a[0].querySelector("input")),c=angular.element(a[0].querySelector("md-input-container")),l=c.controller("mdInputContainer");r(function(t){c.append(t)});var u=angular.element(c[0].querySelector("[ng-messages]"));e.type=e.timeFormat?"text":"time",e.timeFormat=e.timeFormat||"HH:mm",e.autoSwitch=e.autoSwitch||!1,e.$watch(function(){return n.$error},function(t,e){l.setInvalid(!n.$pristine&&!!Object.keys(n.$error).length)},!0),n.$formatters.unshift(function(t){var a=angular.isDate(t)&&moment(t);o(a&&a.isValid()?a.format(e.timeFormat):null)}),n.$validators.format=function(t,a){return!a||angular.isDate(a)||moment(a,e.timeFormat,!0).isValid()},n.$validators.required=function(t,e){return angular.isUndefined(i.required)||!n.$isEmpty(t)||!n.$isEmpty(e)},n.$parsers.unshift(function(t){var a=moment(t,e.timeFormat,!0);if(a.isValid()){if(angular.isDate(n.$modelValue)){var i=moment(n.$modelValue);i.minutes(a.minutes()),i.hours(a.hours()),i.seconds(a.seconds()),a=i}return a.toDate()}return null}),e.showPicker=function(a){t(n.$modelValue,{targetEvent:a,autoSwitch:e.autoSwitch}).then(function(t){s(t,!0)})},m.on("reset input blur",d),e.$on("$destroy",function(){m.off("reset input blur",d)})}}}]),d.directive("mdpTimePicker",["$mdpTimePicker","$timeout",function(t,e){return{restrict:"A",require:"ngModel",scope:{timeFormat:"@mdpFormat",autoSwitch:"=?mdpAutoSwitch"},link:function(e,a,i,n,r){function o(a){t(n.$modelValue,{targetEvent:a,autoSwitch:e.autoSwitch}).then(function(t){n.$setViewValue(moment(t).format(e.format)),n.$render()})}e.format=e.format||"HH:mm",a.on("click",o),e.$on("$destroy",function(){a.off("click",o)})}}}])}(); +!function(){"use strict";function t(t,e,a,i,n,r){var o=this;this.date=moment(n),this.minDate=r.minDate&&moment(r.minDate).isValid()?moment(r.minDate):null,this.maxDate=r.maxDate&&moment(r.maxDate).isValid()?moment(r.maxDate):null,this.displayFormat=r.displayFormat||"ddd, MMM DD",this.dateFilter=angular.isFunction(r.dateFilter)?r.dateFilter:null,this.selectingYear=!1,this.minDate&&this.maxDate&&this.maxDate.isBefore(this.minDate)&&(this.maxDate=moment(this.minDate).add(1,"days")),this.date&&(this.minDate&&this.date.isBefore(this.minDate)&&(this.date=moment(this.minDate)),this.maxDate&&this.date.isAfter(this.maxDate)&&(this.date=moment(this.maxDate))),this.yearItems={currentIndex_:0,PAGE_SIZE:5,START:o.minDate?o.minDate.year():1900,END:o.maxDate?o.maxDate.year():0,getItemAtIndex:function(t){return this.currentIndex_a&&(r={value:n-a,enabled:e.isDayEnabled(moment(e.date).date(n-a).toDate())}),i.push(r)}return i},this.isDayEnabled=function(t){return!(this.minDate&&!(this.minDate<=t)||this.maxDate&&!(this.maxDate>=t)||e.dateFilter&&e.dateFilter(t))},this.selectDate=function(t){e.date.date(t)},this.nextMonth=function(){e.date.add(1,"months")},this.prevMonth=function(){e.date.subtract(1,"months")},this.updateDaysInMonth=function(){e.daysInMonth=e.getDaysInMonth()},t.$watch(function(){return e.date.unix()},function(t,a){t&&t!==a&&e.updateDaysInMonth()})}function a(t,e){return!t||angular.isDate(t)||moment(t,e,!0).isValid()}function i(t,e,a){var a=moment(a,"YYYY-MM-DD",!0),i=angular.isDate(t)?moment(t):moment(t,e,!0);return!t||angular.isDate(t)||!a.isValid()||i.isSameOrAfter(a)}function n(t,e,a){var a=moment(a,"YYYY-MM-DD",!0),i=angular.isDate(t)?moment(t):moment(t,e,!0);return!t||angular.isDate(t)||!a.isValid()||i.isSameOrBefore(a)}function r(t,e,a){var i=angular.isDate(t)?moment(t):moment(t,e,!0);return!t||angular.isDate(t)||!angular.isFunction(a)||!a(i)}function o(t,e,a,i,n){var r=this;this.VIEW_HOURS=1,this.VIEW_MINUTES=2,this.currentView=this.VIEW_HOURS,this.time=moment(a),this.autoSwitch=!!i,this.clockHours=parseInt(this.time.format("h")),this.clockMinutes=parseInt(this.time.minutes()),t.$mdMedia=n,this.switchView=function(){r.currentView=r.currentView==r.VIEW_HOURS?r.VIEW_MINUTES:r.VIEW_HOURS},this.setAM=function(){r.time.hours()>=12&&r.time.hour(r.time.hour()-12)},this.setPM=function(){r.time.hours()<12&&r.time.hour(r.time.hour()+12)},this.cancel=function(){e.cancel()},this.confirm=function(){e.hide(this.time.toDate())}}function s(t){var e=this,a="hours",i="minutes";this.$onInit=function(){switch(e.STEP_DEG=30,e.steps=[],e.CLOCK_TYPES={hours:{range:12},minutes:{range:60}},e.type=e.type||"hours",e.type){case a:for(var t=1;t<=12;t++)e.steps.push(t);e.selected=e.time.hours()||0,e.selected>12&&(e.selected-=12);break;case i:for(var t=5;t<=55;t+=5)e.steps.push(t);e.steps.push(0),e.selected=e.time.minutes()||0}},this.getPointerStyle=function(){var t=1;switch(e.type){case a:t=12;break;case i:t=60}var n=Math.round(e.selected*(360/t))-180;return{"-webkit-transform":"rotate("+n+"deg)","-ms-transform":"rotate("+n+"deg)",transform:"rotate("+n+"deg)"}},this.setTimeByDeg=function(t){t=t>=360?0:t;var n=0;switch(e.type){case a:n=12;break;case i:n=60}e.setTime(Math.round(n/360*t))},this.setTime=function(t,n){switch(this.selected=t,e.type){case a:"PM"==e.time.format("A")&&(t+=12),this.time.hours(t);break;case i:t>59&&(t-=60),this.time.minutes(t)}}}var d=angular.module("mdPickers",["ngMaterial","ngAnimate","ngAria"]);d.config(["$mdIconProvider","mdpIconsRegistry",function(t,e){angular.forEach(e,function(e,a){t.icon(e.id,e.url)})}]),d.run(["$templateCache","mdpIconsRegistry",function(t,e){angular.forEach(e,function(e,a){t.put(e.url,e.svg)})}]),d.constant("mdpIconsRegistry",[{id:"mdp-chevron-left",url:"mdp-chevron-left.svg",svg:''},{id:"mdp-chevron-right",url:"mdp-chevron-right.svg",svg:''},{id:"mdp-access-time",url:"mdp-access-time.svg",svg:''},{id:"mdp-event",url:"mdp-event.svg",svg:''}]),d.directive("ngMessage",["$mdUtil",function(t){return{restrict:"EA",priority:101,compile:function(e){var a=t.getClosest(e,"mdp-time-picker",!0)||t.getClosest(e,"mdp-date-picker",!0);if(a)return e.toggleClass("md-input-message-animation",!0),{}}}}]),d.provider("$mdpDatePicker",function(){var e="OK",a="Cancel",i="ddd, MMM DD";this.setDisplayFormat=function(t){i=t},this.setOKButtonLabel=function(t){e=t},this.setCancelButtonLabel=function(t){a=t},this.$get=["$mdDialog",function(n){var r=function(r,o){return angular.isDate(r)||(r=Date.now()),angular.isObject(o)||(o={}),o.displayFormat=i,n.show({controller:["$scope","$mdDialog","$mdMedia","$timeout","currentDate","options",t],controllerAs:"datepicker",clickOutsideToClose:!0,template:'
{{ datepicker.date.format(\'YYYY\') }}{{ datepicker.date.format(datepicker.displayFormat) }}
{{ item }}
'+a+''+e+"
",targetEvent:o.targetEvent,locals:{currentDate:r,options:o},skipHide:!0})};return r}]}),d.directive("mdpCalendar",["$animate",function(t){return{restrict:"E",bindToController:{date:"=",minDate:"=",maxDate:"=",dateFilter:"="},template:'
{{ calendar.date.format("MMMM YYYY") }}
{{ d }}
{{ day.value }}
',controller:["$scope",e],controllerAs:"calendar",link:function(e,a,i,n){var r=[a[0].querySelector(".mdp-calendar-week-days"),a[0].querySelector(".mdp-calendar-days"),a[0].querySelector(".mdp-calendar-monthyear")].map(function(t){return angular.element(t)});e.$watch(function(){return n.date.format("YYYYMM")},function(e,a){var i=null;if(e>a?i="mdp-animate-next":e"},scope:{minDate:"=mdpMinDate",maxDate:"=mdpMaxDate",dateFilter:"=mdpDateFilter",dateFormat:"@mdpFormat",placeholder:"@mdpPlaceholder",noFloat:"=mdpNoFloat",openOnClick:"=mdpOpenOnClick",disabled:"=?mdpDisabled"},link:{pre:function(t,e,a,i,n){},post:function(e,o,s,d,m){function c(t){p[0].value=t,g.setHasValue(!d.$isEmpty(t))}function l(t){var a=moment(t,angular.isDate(t)?null:e.dateFormat,!0),i=a.format(e.dateFormat);a.isValid()?(c(i),d.$setViewValue(i)):(c(t),d.$setViewValue(t)),!d.$pristine&&f.hasClass("md-auto-hide")&&h.hasClass("md-input-invalid")&&f.removeClass("md-auto-hide"),d.$render()}function u(t){t.target.value!==d.$viewVaue&&l(t.target.value)}var p=angular.element(o[0].querySelector("input")),h=angular.element(o[0].querySelector("md-input-container")),g=h.controller("mdInputContainer");m(function(t){h.append(t)});var f=angular.element(h[0].querySelector("[ng-messages]"));e.type=e.dateFormat?"text":"date",e.dateFormat=e.dateFormat||"YYYY-MM-DD",e.model=d,e.isError=function(){return!d.$pristine&&!!d.$invalid},d.$formatters.unshift(function(t){var a=angular.isDate(t)&&moment(t);c(a&&a.isValid()?a.format(e.dateFormat):null)}),d.$validators.format=function(t,i){return a(i,e.dateFormat)},d.$validators.minDate=function(t,a){return i(a,e.dateFormat,e.minDate)},d.$validators.maxDate=function(t,a){return n(a,e.dateFormat,e.maxDate)},d.$validators.filter=function(t,a){return r(a,e.dateFormat,e.dateFilter)},d.$validators.required=function(t,e){return angular.isUndefined(s.required)||!d.$isEmpty(t)||!d.$isEmpty(e)},d.$parsers.unshift(function(t){var a=moment(t,e.dateFormat,!0);if(a.isValid()){if(angular.isDate(d.$modelValue)){var i=moment(d.$modelValue);i.year(a.year()),i.month(a.month()),i.date(a.date()),a=i}return a.toDate()}return null}),e.showPicker=function(a){t(d.$modelValue,{minDate:e.minDate,maxDate:e.maxDate,dateFilter:e.dateFilter,targetEvent:a}).then(l)},p.on("reset input blur",u),e.$on("$destroy",function(){p.off("reset input blur",u)})}}}}]),d.directive("mdpDatePicker",["$mdpDatePicker","$timeout",function(t,e){return{restrict:"A",require:"ngModel",scope:{minDate:"@min",maxDate:"@max",dateFilter:"=mdpDateFilter",dateFormat:"@mdpFormat"},link:function(e,o,s,d,m){function c(a){t(d.$modelValue,{minDate:e.minDate,maxDate:e.maxDate,dateFilter:e.dateFilter,targetEvent:a}).then(function(t){d.$setViewValue(moment(t).format(e.format)),d.$render()})}e.dateFormat=e.dateFormat||"YYYY-MM-DD",d.$validators.format=function(t,i){return a(i,e.format)},d.$validators.minDate=function(t,a){return i(a,e.format,e.minDate)},d.$validators.maxDate=function(t,a){return n(a,e.format,e.maxDate)},d.$validators.filter=function(t,a){return r(a,e.format,e.dateFilter)},o.on("click",c),e.$on("$destroy",function(){o.off("click",c)})}}}]),d.directive("mdpClock",["$animate","$timeout",function(t,e){return{restrict:"E",bindToController:{type:"@?",time:"=",autoSwitch:"=?"},replace:!0,template:'
{{ step }}
',controller:["$scope",s],controllerAs:"clock",link:function(t,a,i,n){var r=(angular.element(a[0].querySelector(".mdp-pointer")),t.$parent.timepicker),o=function(t){var a=t.currentTarget.getClientRects()[0],i=t.currentTarget.offsetWidth/2-(t.pageX-a.left),o=t.pageY-a.top-t.currentTarget.offsetHeight/2,s=Math.round(Math.atan2(i,o)*(180/Math.PI));e(function(){n.setTimeByDeg(s+180),n.autoSwitch&&["mouseup","click"].indexOf(t.type)!==-1&&r&&r.switchView()})};a.on("mousedown",function(){a.on("mousemove",o)}),a.on("mouseup",function(t){a.off("mousemove")}),a.on("click",o),t.$on("$destroy",function(){a.off("click",o),a.off("mousemove",o)})}}}]),d.provider("$mdpTimePicker",function(){var t="OK",e="Cancel";this.setOKButtonLabel=function(e){t=e},this.setCancelButtonLabel=function(t){e=t},this.$get=["$mdDialog",function(a){var i=function(i,n){return angular.isDate(i)||(i=Date.now()),angular.isObject(n)||(n={}),a.show({controller:["$scope","$mdDialog","time","autoSwitch","$mdMedia",o],controllerAs:"timepicker",clickOutsideToClose:!0,template:'
{{ timepicker.time.format("h") }}:{{ timepicker.time.format("mm") }}
AMPM
'+e+''+t+"
",targetEvent:n.targetEvent,locals:{time:i,autoSwitch:n.autoSwitch},skipHide:!0})};return i}]}),d.directive("mdpTimePicker",["$mdpTimePicker","$timeout",function(t,e){return{restrict:"E",require:"ngModel",transclude:!0,template:function(t,e){var a=angular.isDefined(e.mdpNoFloat),i=angular.isDefined(e.mdpPlaceholder)?e.mdpPlaceholder:"",n=!!angular.isDefined(e.mdpOpenOnClick);return'
"},scope:{timeFormat:"@mdpFormat",placeholder:"@mdpPlaceholder",autoSwitch:"=?mdpAutoSwitch",disabled:"=?mdpDisabled"},link:function(e,a,i,n,r){function o(t){m[0].value=t,l.setHasValue(!n.$isEmpty(t))}function s(t){var a=moment(t,angular.isDate(t)?null:e.timeFormat,!0),i=a.format(e.timeFormat);a.isValid()?(o(i),n.$setViewValue(i)):(o(t),n.$setViewValue(t)),!n.$pristine&&u.hasClass("md-auto-hide")&&c.hasClass("md-input-invalid")&&u.removeClass("md-auto-hide"),n.$render()}function d(t){t.target.value!==n.$viewVaue&&s(t.target.value)}var m=angular.element(a[0].querySelector("input")),c=angular.element(a[0].querySelector("md-input-container")),l=c.controller("mdInputContainer");r(function(t){c.append(t)});var u=angular.element(c[0].querySelector("[ng-messages]"));e.type=e.timeFormat?"text":"time",e.timeFormat=e.timeFormat||"HH:mm",e.autoSwitch=e.autoSwitch||!1,e.$watch(function(){return n.$error},function(t,e){l.setInvalid(!n.$pristine&&!!Object.keys(n.$error).length)},!0),n.$formatters.unshift(function(t){var a=angular.isDate(t)&&moment(t);o(a&&a.isValid()?a.format(e.timeFormat):null)}),n.$validators.format=function(t,a){return!a||angular.isDate(a)||moment(a,e.timeFormat,!0).isValid()},n.$validators.required=function(t,e){return angular.isUndefined(i.required)||!n.$isEmpty(t)||!n.$isEmpty(e)},n.$parsers.unshift(function(t){var a=moment(t,e.timeFormat,!0);if(a.isValid()){if(angular.isDate(n.$modelValue)){var i=moment(n.$modelValue);i.minutes(a.minutes()),i.hours(a.hours()),i.seconds(a.seconds()),a=i}return a.toDate()}return null}),e.showPicker=function(a){t(n.$modelValue,{targetEvent:a,autoSwitch:e.autoSwitch}).then(function(t){s(t,!0)})},m.on("reset input blur",d),e.$on("$destroy",function(){m.off("reset input blur",d)})}}}]),d.directive("mdpTimePicker",["$mdpTimePicker","$timeout",function(t,e){return{restrict:"A",require:"ngModel",scope:{timeFormat:"@mdpFormat",autoSwitch:"=?mdpAutoSwitch"},link:function(e,a,i,n,r){function o(a){t(n.$modelValue,{targetEvent:a,autoSwitch:e.autoSwitch}).then(function(t){n.$setViewValue(moment(t).format(e.format)),n.$render()})}e.format=e.format||"HH:mm",a.on("click",o),e.$on("$destroy",function(){a.off("click",o)})}}}])}(); //# sourceMappingURL=mdPickers.min.js.map diff --git a/dist/mdPickers.min.js.map b/dist/mdPickers.min.js.map index 99e5a176..af4c42e7 100644 --- a/dist/mdPickers.min.js.map +++ b/dist/mdPickers.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["mdPickers.min.js"],"names":["DatePickerCtrl","$scope","$mdDialog","$mdMedia","$timeout","currentDate","options","self","this","date","moment","minDate","isValid","maxDate","displayFormat","dateFilter","angular","isFunction","selectingYear","isBefore","add","isAfter","yearItems","currentIndex_","PAGE_SIZE","START","year","END","getItemAtIndex","index","getLength","Math","min","floor","abs","selectYear","animate","showYear","yearTopIndex","showCalendar","cancel","confirm","hide","toDate","animating","noop","then","CalendarCtrl","dow","localeData","firstDayOfWeek","weekDays","concat","weekdaysMin","slice","daysInMonth","getDaysInMonth","days","firstDay","day","length","arr","i","value","enabled","isDayEnabled","push","selectDate","dom","nextMonth","prevMonth","subtract","updateDaysInMonth","$watch","unix","newValue","oldValue","formatValidator","format","isDate","minDateValidator","isSameOrAfter","maxDateValidator","isSameOrBefore","filterValidator","filter","TimePickerCtrl","time","autoSwitch","VIEW_HOURS","VIEW_MINUTES","currentView","clockHours","parseInt","clockMinutes","minutes","switchView","setAM","hours","hour","setPM","ClockCtrl","TYPE_HOURS","TYPE_MINUTES","STEP_DEG","steps","CLOCK_TYPES","range","getPointerStyle","divider","type","degrees","round","selected","-webkit-transform","-ms-transform","transform","setTimeByDeg","deg","setTime","init","module","config","$mdIconProvider","mdpIconsRegistry","forEach","icon","id","url","run","$templateCache","put","svg","constant","directive","$mdUtil","restrict","priority","compile","element","inputContainer","getClosest","toggleClass","provider","LABEL_OK","LABEL_CANCEL","DISPLAY_FORMAT","setDisplayFormat","setOKButtonLabel","label","setCancelButtonLabel","$get","datePicker","Date","now","isObject","show","controller","controllerAs","clickOutsideToClose","template","targetEvent","locals","skipHide","$animate","bindToController","link","scope","attrs","ctrl","animElements","querySelector","map","a","direction","addClass","removeClass","$mdpDatePicker","require","transclude","noFloat","isDefined","mdpNoFloat","placeholder","mdpPlaceholder","openOnClick","mdpOpenOnClick","mdpDisabled","dateFormat","disabled","pre","ngModel","$transclude","post","updateInputElement","inputElement","inputContainerCtrl","setHasValue","$isEmpty","updateDate","strValue","$setViewValue","$pristine","messages","hasClass","$render","onInputElementEvents","event","target","$viewVaue","clone","append","model","isError","$invalid","$formatters","unshift","$validators","modelValue","viewValue","required","isUndefined","$parsers","parsed","$modelValue","originalModel","month","showPicker","ev","on","$on","off","replace","timepickerCtrl","$parent","timepicker","onEvent","containerCoords","currentTarget","getClientRects","x","offsetWidth","pageX","left","y","pageY","top","offsetHeight","atan2","PI","indexOf","e","timePicker","$mdpTimePicker","timeFormat","updateTime","$error","setInvalid","Object","keys","seconds"],"mappings":"CAAA,WACA,YA8DA,SAASA,GAAeC,EAAQC,EAAWC,EAAUC,EAAUC,EAAaC,GACxE,GAAIC,GAAOC,IAEXA,MAAKC,KAAOC,OAAOL,GACnBG,KAAKG,QAAUL,EAAQK,SAAWD,OAAOJ,EAAQK,SAASC,UAAYF,OAAOJ,EAAQK,SAAW,KAChGH,KAAKK,QAAUP,EAAQO,SAAWH,OAAOJ,EAAQO,SAASD,UAAYF,OAAOJ,EAAQO,SAAW,KAChGL,KAAKM,cAAgBR,EAAQQ,eAAiB,cAC9CN,KAAKO,WAAaC,QAAQC,WAAWX,EAAQS,YAAcT,EAAQS,WAAa,KAChFP,KAAKU,eAAgB,EAGpBV,KAAKG,SAAWH,KAAKK,SACpBL,KAAKK,QAAQM,SAASX,KAAKG,WAC9BH,K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ASuH,EAAgBzP,GACtF,OACIoI,SAAU,IACV0C,QAAS,UACTX,OACIuF,WAAc,aACdtK,WAAc,mBAElB8E,KAAM,SAASC,EAAO5B,EAAS6B,EAAOuB,EAASC,GAE3C,QAASmC,GAAWC,GAChByB,EAAe9D,EAAQiC,aACnB/D,YAAamE,EACb5I,WAAY+E,EAAM/E,aACnB1C,KAAK,SAASyC,GACbwG,EAAQU,cAAc/L,OAAO6E,GAAMT,OAAOyF,EAAMzF,SAChDiH,EAAQc,YAPhBtC,EAAMzF,OAASyF,EAAMzF,QAAU,QAW/B6D,EAAQ0F,GAAG,QAASF,GAEpB5D,EAAM+D,IAAI,WAAY,WAClB3F,EAAQ4F,IAAI,QAASJ","file":"mdPickers.min.js","sourcesContent":["(function() {\n\"use strict\";\n/* global moment, angular */\n\nvar module = angular.module(\"mdPickers\", [\n\t\"ngMaterial\",\n\t\"ngAnimate\",\n\t\"ngAria\"\n]);\n\nmodule.config([\"$mdIconProvider\", \"mdpIconsRegistry\", function($mdIconProvider, mdpIconsRegistry) {\n\tangular.forEach(mdpIconsRegistry, function(icon, index) {\n\t\t$mdIconProvider.icon(icon.id, icon.url);\n\t});\n}]);\n\nmodule.run([\"$templateCache\", \"mdpIconsRegistry\", function($templateCache, mdpIconsRegistry) {\n\tangular.forEach(mdpIconsRegistry, function(icon, index) {\n\t\t$templateCache.put(icon.url, icon.svg);\n\t});\n}]);\nmodule.constant(\"mdpIconsRegistry\", [\n {\n id: 'mdp-chevron-left',\n url: 'mdp-chevron-left.svg',\n svg: ''\n },\n {\n id: 'mdp-chevron-right',\n url: 'mdp-chevron-right.svg',\n svg: ''\n },\n {\n id: 'mdp-access-time',\n url: 'mdp-access-time.svg',\n svg: ''\n },\n {\n id: 'mdp-event',\n url: 'mdp-event.svg',\n svg: ''\n }\n]);\nmodule.directive(\"ngMessage\", [\"$mdUtil\", function($mdUtil) {\n return {\n restrict: \"EA\",\n priority: 101,\n compile: function(element) {\n var inputContainer = $mdUtil.getClosest(element, \"mdp-time-picker\", true) ||\n $mdUtil.getClosest(element, \"mdp-date-picker\", true);\n \n // If we are not a child of an input container, don't do anything\n if (!inputContainer) return;\n \n // Add our animation class\n element.toggleClass('md-input-message-animation', true);\n \n return {};\n }\n } \n}]);\n/* global moment, angular */\n\nfunction DatePickerCtrl($scope, $mdDialog, $mdMedia, $timeout, currentDate, options) {\n var self = this;\n\n this.date = moment(currentDate);\n this.minDate = options.minDate && moment(options.minDate).isValid() ? moment(options.minDate) : null;\n this.maxDate = options.maxDate && moment(options.maxDate).isValid() ? moment(options.maxDate) : null;\n this.displayFormat = options.displayFormat || \"ddd, MMM DD\";\n this.dateFilter = angular.isFunction(options.dateFilter) ? options.dateFilter : null;\n this.selectingYear = false;\n \n // validate min and max date\n\tif (this.minDate && this.maxDate) {\n\t\tif (this.maxDate.isBefore(this.minDate)) {\n\t\t\tthis.maxDate = moment(this.minDate).add(1, 'days');\n\t\t}\n\t}\n\t\n\tif (this.date) {\n\t\t// check min date\n \tif (this.minDate && this.date.isBefore(this.minDate)) {\n\t\t\tthis.date = moment(this.minDate);\n \t}\n \t\n \t// check max date\n \tif (this.maxDate && this.date.isAfter(this.maxDate)) {\n\t\t\tthis.date = moment(this.maxDate);\n \t}\n\t}\n\t\n\tthis.yearItems = {\n currentIndex_: 0,\n PAGE_SIZE: 5,\n START: (self.minDate ? self.minDate.year() : 1900),\n END: (self.maxDate ? self.maxDate.year() : 0),\n getItemAtIndex: function(index) {\n \tif(this.currentIndex_ < index)\n this.currentIndex_ = index;\n \t\n \treturn this.START + index;\n },\n getLength: function() {\n return Math.min(\n this.currentIndex_ + Math.floor(this.PAGE_SIZE / 2),\n Math.abs(this.START - this.END) + 1\n );\n }\n };\n\n $scope.$mdMedia = $mdMedia;\n $scope.year = this.date.year();\n\n\tthis.selectYear = function(year) {\n self.date.year(year);\n $scope.year = year;\n self.selectingYear = false;\n self.animate();\n };\n \n this.showYear = function() { \n self.yearTopIndex = (self.date.year() - self.yearItems.START) + Math.floor(self.yearItems.PAGE_SIZE / 2);\n self.yearItems.currentIndex_ = (self.date.year() - self.yearItems.START) + 1;\n self.selectingYear = true;\n };\n \n this.showCalendar = function() {\n self.selectingYear = false;\n };\n\n this.cancel = function() {\n $mdDialog.cancel();\n };\n\n this.confirm = function() {\n \tvar date = this.date;\n \t\n \tif (this.minDate && this.date.isBefore(this.minDate)) {\n \t\tdate = moment(this.minDate);\n \t}\n \t\n \tif (this.maxDate && this.date.isAfter(this.maxDate)) {\n \t\tdate = moment(this.maxDate);\n \t} \t\n \t\n $mdDialog.hide(date.toDate());\n };\n \n this.animate = function() {\n self.animating = true;\n $timeout(angular.noop).then(function() {\n self.animating = false;\n }) \n };\n}\n\nmodule.provider(\"$mdpDatePicker\", function() {\n var LABEL_OK = \"OK\",\n LABEL_CANCEL = \"Cancel\",\n DISPLAY_FORMAT = \"ddd, MMM DD\";\n \n this.setDisplayFormat = function(format) {\n DISPLAY_FORMAT = format; \n };\n \n this.setOKButtonLabel = function(label) {\n LABEL_OK = label;\n };\n \n this.setCancelButtonLabel = function(label) {\n LABEL_CANCEL = label;\n };\n \n this.$get = [\"$mdDialog\", function($mdDialog) {\n var datePicker = function(currentDate, options) {\n if (!angular.isDate(currentDate)) currentDate = Date.now();\n if (!angular.isObject(options)) options = {};\n \n options.displayFormat = DISPLAY_FORMAT;\n \n return $mdDialog.show({\n controller: ['$scope', '$mdDialog', '$mdMedia', '$timeout', 'currentDate', 'options', DatePickerCtrl],\n controllerAs: 'datepicker',\n clickOutsideToClose: true,\n template: '' +\n '' +\n '
' +\n '' +\n '{{ datepicker.date.format(\\'YYYY\\') }}' +\n '{{ datepicker.date.format(datepicker.displayFormat) }} ' +\n '' + \n '
' + \n '
' + \n '
' +\n '' +\n '
' +\n '{{ item }}' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n \t'' +\n '' + LABEL_CANCEL + '' +\n '' + LABEL_OK + '' +\n '' +\n '
' +\n '
' +\n '
',\n targetEvent: options.targetEvent,\n locals: {\n currentDate: currentDate,\n options: options\n },\n skipHide: true\n });\n };\n \n return datePicker;\n }];\n});\n\nfunction CalendarCtrl($scope) {\n\tvar self = this;\n\tthis.dow = moment.localeData().firstDayOfWeek();\n\t\n this.weekDays = [].concat(\n moment.weekdaysMin().slice(\n this.dow\n ),\n moment.weekdaysMin().slice(\n 0, \n this.dow\n )\n );\n \n this.daysInMonth = [];\n \n this.getDaysInMonth = function() {\n var days = self.date.daysInMonth(),\n firstDay = moment(self.date).date(1).day() - this.dow;\n \n if(firstDay < 0) firstDay = this.weekDays.length - 1;\n \n\n var arr = [];\n for(var i = 1; i <= (firstDay + days); i++) {\n var day = null;\n if(i > firstDay) {\n day = {\n value: (i - firstDay),\n enabled: self.isDayEnabled(moment(self.date).date(i - firstDay).toDate())\n };\n }\n arr.push(day);\n }\n \n return arr;\n };\n \n this.isDayEnabled = function(day) {\n return (!this.minDate || this.minDate <= day) && \n (!this.maxDate || this.maxDate >= day) && \n (!self.dateFilter || !self.dateFilter(day));\n };\n \n this.selectDate = function(dom) {\n self.date.date(dom);\n };\n\n this.nextMonth = function() {\n self.date.add(1, 'months');\n };\n\n this.prevMonth = function() {\n self.date.subtract(1, 'months');\n };\n \n this.updateDaysInMonth = function() {\n self.daysInMonth = self.getDaysInMonth();\n };\n \n $scope.$watch(function() { return self.date.unix() }, function(newValue, oldValue) {\n if(newValue && newValue !== oldValue)\n self.updateDaysInMonth();\n })\n \n self.updateDaysInMonth();\n}\n\nmodule.directive(\"mdpCalendar\", [\"$animate\", function($animate) {\n return {\n restrict: 'E',\n bindToController: {\n \"date\": \"=\",\n \"minDate\": \"=\",\n \"maxDate\": \"=\",\n \"dateFilter\": \"=\"\n },\n template: '
' +\n '
' +\n '' +\n '
{{ calendar.date.format(\"MMMM YYYY\") }}
' +\n '' +\n '
' +\n '
' +\n '
{{ d }}
' +\n '
' +\n '
' +\n '
' +\n '{{ day.value }}' +\n '
' +\n '
' +\n '
' +\n '
',\n controller: [\"$scope\", CalendarCtrl],\n controllerAs: \"calendar\",\n link: function(scope, element, attrs, ctrl) {\n var animElements = [\n element[0].querySelector(\".mdp-calendar-week-days\"),\n element[0].querySelector('.mdp-calendar-days'),\n element[0].querySelector('.mdp-calendar-monthyear')\n ].map(function(a) {\n return angular.element(a); \n });\n \n scope.$watch(function() { return ctrl.date.format(\"YYYYMM\") }, function(newValue, oldValue) {\n var direction = null;\n \n if(newValue > oldValue)\n direction = \"mdp-animate-next\";\n else if(newValue < oldValue)\n direction = \"mdp-animate-prev\";\n \n if(direction) {\n for(var i in animElements) {\n animElements[i].addClass(direction);\n $animate.removeClass(animElements[i], direction);\n }\n }\n });\n }\n }\n}]);\n\nfunction formatValidator(value, format) {\n return !value || angular.isDate(value) || moment(value, format, true).isValid();\n}\n\nfunction minDateValidator(value, format, minDate) {\n var minDate = moment(minDate, \"YYYY-MM-DD\", true);\n var date = angular.isDate(value) ? moment(value) : moment(value, format, true);\n \n return !value || \n angular.isDate(value) || \n !minDate.isValid() || \n date.isSameOrAfter(minDate);\n}\n\nfunction maxDateValidator(value, format, maxDate) {\n var maxDate = moment(maxDate, \"YYYY-MM-DD\", true);\n var date = angular.isDate(value) ? moment(value) : moment(value, format, true);\n \n return !value || \n angular.isDate(value) || \n !maxDate.isValid() || \n date.isSameOrBefore(maxDate);\n}\n\nfunction filterValidator(value, format, filter) {\n var date = angular.isDate(value) ? moment(value) : moment(value, format, true);\n \n return !value || \n angular.isDate(value) || \n !angular.isFunction(filter) || \n !filter(date);\n}\n\nfunction requiredValidator(value, ngModel) {\n return value\n}\n\nmodule.directive(\"mdpDatePicker\", [\"$mdpDatePicker\", \"$timeout\", function($mdpDatePicker, $timeout) {\n return {\n restrict: 'E',\n require: 'ngModel',\n transclude: true,\n template: function(element, attrs) {\n var noFloat = angular.isDefined(attrs.mdpNoFloat),\n placeholder = angular.isDefined(attrs.mdpPlaceholder) ? attrs.mdpPlaceholder : \"\",\n openOnClick = angular.isDefined(attrs.mdpOpenOnClick) ? true : false;\n \n return '
' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
';\n },\n scope: {\n \"minDate\": \"=mdpMinDate\",\n \"maxDate\": \"=mdpMaxDate\",\n \"dateFilter\": \"=mdpDateFilter\",\n \"dateFormat\": \"@mdpFormat\",\n \"placeholder\": \"@mdpPlaceholder\",\n \"noFloat\": \"=mdpNoFloat\",\n \"openOnClick\": \"=mdpOpenOnClick\",\n \"disabled\": \"=?mdpDisabled\"\n },\n link: {\n pre: function(scope, element, attrs, ngModel, $transclude) {\n \n },\n post: function(scope, element, attrs, ngModel, $transclude) {\n var inputElement = angular.element(element[0].querySelector('input')),\n inputContainer = angular.element(element[0].querySelector('md-input-container')),\n inputContainerCtrl = inputContainer.controller(\"mdInputContainer\");\n \n $transclude(function(clone) {\n inputContainer.append(clone); \n }); \n \n var messages = angular.element(inputContainer[0].querySelector(\"[ng-messages]\"));\n \n scope.type = scope.dateFormat ? \"text\" : \"date\"\n scope.dateFormat = scope.dateFormat || \"YYYY-MM-DD\";\n scope.model = ngModel;\n \n scope.isError = function() {\n return !ngModel.$pristine && !!ngModel.$invalid;\n };\n \n // update input element if model has changed\n ngModel.$formatters.unshift(function(value) {\n var date = angular.isDate(value) && moment(value);\n if(date && date.isValid()) \n updateInputElement(date.format(scope.dateFormat));\n else\n updateInputElement(null);\n });\n \n ngModel.$validators.format = function(modelValue, viewValue) {\n return formatValidator(viewValue, scope.dateFormat);\n };\n \n ngModel.$validators.minDate = function(modelValue, viewValue) {\n return minDateValidator(viewValue, scope.dateFormat, scope.minDate);\n };\n \n ngModel.$validators.maxDate = function(modelValue, viewValue) {\n return maxDateValidator(viewValue, scope.dateFormat, scope.maxDate);\n };\n \n ngModel.$validators.filter = function(modelValue, viewValue) {\n return filterValidator(viewValue, scope.dateFormat, scope.dateFilter);\n };\n \n ngModel.$validators.required = function(modelValue, viewValue) {\n return angular.isUndefined(attrs.required) || !ngModel.$isEmpty(modelValue) || !ngModel.$isEmpty(viewValue);\n };\n \n ngModel.$parsers.unshift(function(value) {\n var parsed = moment(value, scope.dateFormat, true);\n if(parsed.isValid()) {\n if(angular.isDate(ngModel.$modelValue)) {\n var originalModel = moment(ngModel.$modelValue);\n originalModel.year(parsed.year());\n originalModel.month(parsed.month());\n originalModel.date(parsed.date());\n \n parsed = originalModel;\n }\n return parsed.toDate(); \n } else\n return null;\n });\n \n // update input element value\n function updateInputElement(value) {\n inputElement[0].value = value;\n inputContainerCtrl.setHasValue(!ngModel.$isEmpty(value));\n }\n \n function updateDate(date) {\n var value = moment(date, angular.isDate(date) ? null : scope.dateFormat, true),\n strValue = value.format(scope.dateFormat);\n \n if(value.isValid()) {\n updateInputElement(strValue);\n ngModel.$setViewValue(strValue);\n } else {\n updateInputElement(date);\n ngModel.$setViewValue(date);\n }\n \n if(!ngModel.$pristine && \n messages.hasClass(\"md-auto-hide\") && \n inputContainer.hasClass(\"md-input-invalid\")) messages.removeClass(\"md-auto-hide\");\n \n ngModel.$render();\n }\n \n scope.showPicker = function(ev) {\n $mdpDatePicker(ngModel.$modelValue, {\n \t minDate: scope.minDate, \n \t maxDate: scope.maxDate,\n \t dateFilter: scope.dateFilter,\n \t targetEvent: ev\n \t }).then(updateDate);\n };\n \n function onInputElementEvents(event) {\n if(event.target.value !== ngModel.$viewVaue)\n updateDate(event.target.value);\n }\n \n inputElement.on(\"reset input blur\", onInputElementEvents);\n \n scope.$on(\"$destroy\", function() {\n inputElement.off(\"reset input blur\", onInputElementEvents);\n });\n }\n }\n };\n}]);\n\n\nmodule.directive(\"mdpDatePicker\", [\"$mdpDatePicker\", \"$timeout\", function($mdpDatePicker, $timeout) {\n return {\n restrict: 'A',\n require: 'ngModel',\n scope: {\n \"minDate\": \"@min\",\n \"maxDate\": \"@max\",\n \"dateFilter\": \"=mdpDateFilter\",\n \"dateFormat\": \"@mdpFormat\",\n },\n link: function(scope, element, attrs, ngModel, $transclude) {\n scope.dateFormat = scope.dateFormat || \"YYYY-MM-DD\";\n \n ngModel.$validators.format = function(modelValue, viewValue) {\n return formatValidator(viewValue, scope.format);\n };\n \n ngModel.$validators.minDate = function(modelValue, viewValue) {\n return minDateValidator(viewValue, scope.format, scope.minDate);\n };\n \n ngModel.$validators.maxDate = function(modelValue, viewValue) {\n return maxDateValidator(viewValue, scope.format, scope.maxDate);\n };\n \n ngModel.$validators.filter = function(modelValue, viewValue) {\n return filterValidator(viewValue, scope.format, scope.dateFilter);\n };\n \n function showPicker(ev) {\n $mdpDatePicker(ngModel.$modelValue, {\n \t minDate: scope.minDate, \n \t maxDate: scope.maxDate,\n \t dateFilter: scope.dateFilter,\n \t targetEvent: ev\n \t }).then(function(time) {\n ngModel.$setViewValue(moment(time).format(scope.format));\n ngModel.$render();\n });\n };\n \n element.on(\"click\", showPicker);\n \n scope.$on(\"$destroy\", function() {\n element.off(\"click\", showPicker);\n });\n }\n }\n}]);\n/* global moment, angular */\n\nfunction TimePickerCtrl($scope, $mdDialog, time, autoSwitch, $mdMedia) {\n\tvar self = this;\n this.VIEW_HOURS = 1;\n this.VIEW_MINUTES = 2;\n this.currentView = this.VIEW_HOURS;\n this.time = moment(time);\n this.autoSwitch = !!autoSwitch;\n \n this.clockHours = parseInt(this.time.format(\"h\"));\n this.clockMinutes = parseInt(this.time.minutes());\n \n\t$scope.$mdMedia = $mdMedia;\n\t\n\tthis.switchView = function() {\n\t self.currentView = self.currentView == self.VIEW_HOURS ? self.VIEW_MINUTES : self.VIEW_HOURS;\n\t};\n \n\tthis.setAM = function() {\n if(self.time.hours() >= 12)\n self.time.hour(self.time.hour() - 12);\n\t};\n \n this.setPM = function() {\n if(self.time.hours() < 12)\n self.time.hour(self.time.hour() + 12);\n\t};\n \n this.cancel = function() {\n $mdDialog.cancel();\n };\n\n this.confirm = function() {\n $mdDialog.hide(this.time.toDate());\n };\n}\n\nfunction ClockCtrl($scope) {\n var TYPE_HOURS = \"hours\";\n var TYPE_MINUTES = \"minutes\";\n var self = this;\n \n this.STEP_DEG = 360 / 12;\n this.steps = [];\n \n this.CLOCK_TYPES = {\n \"hours\": {\n range: 12,\n },\n \"minutes\": {\n range: 60,\n }\n }\n \n this.getPointerStyle = function() {\n var divider = 1;\n switch(self.type) {\n case TYPE_HOURS:\n divider = 12;\n break;\n case TYPE_MINUTES:\n divider = 60;\n break;\n } \n var degrees = Math.round(self.selected * (360 / divider)) - 180;\n return { \n \"-webkit-transform\": \"rotate(\" + degrees + \"deg)\",\n \"-ms-transform\": \"rotate(\" + degrees + \"deg)\",\n \"transform\": \"rotate(\" + degrees + \"deg)\"\n }\n };\n \n this.setTimeByDeg = function(deg) {\n deg = deg >= 360 ? 0 : deg;\n var divider = 0;\n switch(self.type) {\n case TYPE_HOURS:\n divider = 12;\n break;\n case TYPE_MINUTES:\n divider = 60;\n break;\n } \n \n self.setTime(\n Math.round(divider / 360 * deg)\n );\n };\n \n this.setTime = function(time, type) {\n this.selected = time;\n \n switch(self.type) {\n case TYPE_HOURS:\n if(self.time.format(\"A\") == \"PM\") time += 12;\n this.time.hours(time);\n break;\n case TYPE_MINUTES:\n if(time > 59) time -= 60;\n this.time.minutes(time);\n break;\n }\n \n };\n \n this.init = function() {\n self.type = self.type || \"hours\";\n switch(self.type) {\n case TYPE_HOURS:\n for(var i = 1; i <= 12; i++)\n self.steps.push(i);\n self.selected = self.time.hours() || 0;\n if(self.selected > 12) self.selected -= 12;\n \n break;\n case TYPE_MINUTES:\n for(var i = 5; i <= 55; i+=5)\n self.steps.push(i);\n self.steps.push(0);\n self.selected = self.time.minutes() || 0;\n \n break;\n }\n };\n \n this.init();\n}\n\nmodule.directive(\"mdpClock\", [\"$animate\", \"$timeout\", function($animate, $timeout) {\n return {\n restrict: 'E',\n bindToController: {\n 'type': '@?',\n 'time': '=',\n 'autoSwitch': '=?'\n },\n replace: true,\n template: '
' +\n '
' +\n '' +\n '' +\n '' +\n '' +\n '{{ step }}' +\n '
' +\n '
',\n controller: [\"$scope\", ClockCtrl],\n controllerAs: \"clock\",\n link: function(scope, element, attrs, ctrl) {\n var pointer = angular.element(element[0].querySelector(\".mdp-pointer\")),\n timepickerCtrl = scope.$parent.timepicker;\n \n var onEvent = function(event) {\n var containerCoords = event.currentTarget.getClientRects()[0];\n var x = ((event.currentTarget.offsetWidth / 2) - (event.pageX - containerCoords.left)),\n y = ((event.pageY - containerCoords.top) - (event.currentTarget.offsetHeight / 2));\n\n var deg = Math.round((Math.atan2(x, y) * (180 / Math.PI)));\n $timeout(function() {\n ctrl.setTimeByDeg(deg + 180);\n if(ctrl.autoSwitch && [\"mouseup\", \"click\"].indexOf(event.type) !== -1 && timepickerCtrl) timepickerCtrl.switchView();\n });\n }; \n \n element.on(\"mousedown\", function() {\n element.on(\"mousemove\", onEvent);\n });\n \n element.on(\"mouseup\", function(e) {\n element.off(\"mousemove\");\n });\n \n element.on(\"click\", onEvent);\n scope.$on(\"$destroy\", function() {\n element.off(\"click\", onEvent);\n element.off(\"mousemove\", onEvent); \n });\n }\n }\n}]);\n\nmodule.provider(\"$mdpTimePicker\", function() {\n var LABEL_OK = \"OK\",\n LABEL_CANCEL = \"Cancel\";\n \n this.setOKButtonLabel = function(label) {\n LABEL_OK = label;\n };\n \n this.setCancelButtonLabel = function(label) {\n LABEL_CANCEL = label;\n };\n \n this.$get = [\"$mdDialog\", function($mdDialog) {\n var timePicker = function(time, options) {\n if(!angular.isDate(time)) time = Date.now();\n if (!angular.isObject(options)) options = {};\n \n return $mdDialog.show({\n controller: ['$scope', '$mdDialog', 'time', 'autoSwitch', '$mdMedia', TimePickerCtrl],\n controllerAs: 'timepicker',\n clickOutsideToClose: true,\n template: '' +\n '' +\n '' +\n '
' +\n '{{ timepicker.time.format(\"h\") }}:' + \n '{{ timepicker.time.format(\"mm\") }}' +\n '
' +\n '
' + \n 'AM' +\n '= 12 }\">PM' +\n '
' + \n '
' +\n '
' +\n '
' +\n\t '' +\n\t '' +\n '
' +\n \n '' +\n\t \t'' +\n '' + LABEL_CANCEL + '' +\n '' + LABEL_OK + '' +\n '' +\n '
' +\n '
' +\n '
',\n targetEvent: options.targetEvent,\n locals: {\n time: time,\n autoSwitch: options.autoSwitch\n },\n skipHide: true\n });\n };\n \n return timePicker;\n }];\n});\n\nmodule.directive(\"mdpTimePicker\", [\"$mdpTimePicker\", \"$timeout\", function($mdpTimePicker, $timeout) {\n return {\n restrict: 'E',\n require: 'ngModel',\n transclude: true,\n template: function(element, attrs) {\n var noFloat = angular.isDefined(attrs.mdpNoFloat),\n placeholder = angular.isDefined(attrs.mdpPlaceholder) ? attrs.mdpPlaceholder : \"\",\n openOnClick = angular.isDefined(attrs.mdpOpenOnClick) ? true : false;\n \n return '
' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
';\n },\n scope: {\n \"timeFormat\": \"@mdpFormat\",\n \"placeholder\": \"@mdpPlaceholder\",\n \"autoSwitch\": \"=?mdpAutoSwitch\",\n \"disabled\": \"=?mdpDisabled\"\n },\n link: function(scope, element, attrs, ngModel, $transclude) {\n var inputElement = angular.element(element[0].querySelector('input')),\n inputContainer = angular.element(element[0].querySelector('md-input-container')),\n inputContainerCtrl = inputContainer.controller(\"mdInputContainer\");\n \n $transclude(function(clone) {\n inputContainer.append(clone); \n });\n \n var messages = angular.element(inputContainer[0].querySelector(\"[ng-messages]\"));\n \n scope.type = scope.timeFormat ? \"text\" : \"time\"\n scope.timeFormat = scope.timeFormat || \"HH:mm\";\n scope.autoSwitch = scope.autoSwitch || false;\n \n scope.$watch(function() { return ngModel.$error }, function(newValue, oldValue) {\n inputContainerCtrl.setInvalid(!ngModel.$pristine && !!Object.keys(ngModel.$error).length);\n }, true);\n \n // update input element if model has changed\n ngModel.$formatters.unshift(function(value) {\n var time = angular.isDate(value) && moment(value);\n if(time && time.isValid()) \n updateInputElement(time.format(scope.timeFormat));\n else\n updateInputElement(null);\n });\n \n ngModel.$validators.format = function(modelValue, viewValue) {\n return !viewValue || angular.isDate(viewValue) || moment(viewValue, scope.timeFormat, true).isValid();\n };\n \n ngModel.$validators.required = function(modelValue, viewValue) {\n return angular.isUndefined(attrs.required) || !ngModel.$isEmpty(modelValue) || !ngModel.$isEmpty(viewValue);\n };\n \n ngModel.$parsers.unshift(function(value) {\n var parsed = moment(value, scope.timeFormat, true);\n if(parsed.isValid()) {\n if(angular.isDate(ngModel.$modelValue)) {\n var originalModel = moment(ngModel.$modelValue);\n originalModel.minutes(parsed.minutes());\n originalModel.hours(parsed.hours());\n originalModel.seconds(parsed.seconds());\n \n parsed = originalModel;\n }\n return parsed.toDate(); \n } else\n return null;\n });\n \n // update input element value\n function updateInputElement(value) {\n inputElement[0].value = value;\n inputContainerCtrl.setHasValue(!ngModel.$isEmpty(value));\n }\n \n function updateTime(time) {\n var value = moment(time, angular.isDate(time) ? null : scope.timeFormat, true),\n strValue = value.format(scope.timeFormat);\n\n if(value.isValid()) {\n updateInputElement(strValue);\n ngModel.$setViewValue(strValue);\n } else {\n updateInputElement(time);\n ngModel.$setViewValue(time);\n }\n \n if(!ngModel.$pristine && \n messages.hasClass(\"md-auto-hide\") && \n inputContainer.hasClass(\"md-input-invalid\")) messages.removeClass(\"md-auto-hide\");\n \n ngModel.$render();\n }\n \n scope.showPicker = function(ev) {\n $mdpTimePicker(ngModel.$modelValue, {\n targetEvent: ev,\n autoSwitch: scope.autoSwitch\n }).then(function(time) {\n updateTime(time, true);\n });\n };\n \n function onInputElementEvents(event) {\n if(event.target.value !== ngModel.$viewVaue)\n updateTime(event.target.value);\n }\n \n inputElement.on(\"reset input blur\", onInputElementEvents);\n \n scope.$on(\"$destroy\", function() {\n inputElement.off(\"reset input blur\", onInputElementEvents);\n })\n }\n };\n}]);\n\nmodule.directive(\"mdpTimePicker\", [\"$mdpTimePicker\", \"$timeout\", function($mdpTimePicker, $timeout) {\n return {\n restrict: 'A',\n require: 'ngModel',\n scope: {\n \"timeFormat\": \"@mdpFormat\",\n \"autoSwitch\": \"=?mdpAutoSwitch\",\n },\n link: function(scope, element, attrs, ngModel, $transclude) {\n scope.format = scope.format || \"HH:mm\";\n function showPicker(ev) {\n $mdpTimePicker(ngModel.$modelValue, {\n targetEvent: ev,\n autoSwitch: scope.autoSwitch\n }).then(function(time) {\n ngModel.$setViewValue(moment(time).format(scope.format));\n ngModel.$render();\n });\n };\n \n element.on(\"click\", showPicker);\n \n scope.$on(\"$destroy\", function() {\n element.off(\"click\", showPicker);\n });\n }\n }\n}]);\n\n})();"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["mdPickers.min.js"],"names":["DatePickerCtrl","$scope","$mdDialog","$mdMedia","$timeout","currentDate","options","self","this","date","moment","minDate","isValid","maxDate","displayFormat","dateFilter","angular","isFunction","selectingYear","isBefore","add","isAfter","yearItems","currentIndex_","PAGE_SIZE","START","year","END","getItemAtIndex","index","getLength","Math","min","floor","abs","selectYear","animate","showYear","yearTopIndex","showCalendar","cancel","confirm","hide","toDate","animating","noop","then","CalendarCtrl","$onInit","daysInMonth","dow","localeData","firstDayOfWeek","weekDays","concat","weekdaysMin","slice","$watch","unix","newValue","oldValue","updateDaysInMonth","getDaysInMonth","days","firstDay","day","length","arr","i","value","enabled","isDayEnabled","push","selectDate","dom","nextMonth","prevMonth","subtract","formatValidator","format","isDate","minDateValidator","isSameOrAfter","maxDateValidator","isSameOrBefore","filterValidator","filter","TimePickerCtrl","time","autoSwitch","VIEW_HOURS","VIEW_MINUTES","currentView","clockHours","parseInt","clockMinutes","minutes","switchView","setAM","hours","hour","setPM","ClockCtrl","TYPE_HOURS","TYPE_MINUTES","STEP_DEG","steps","CLOCK_TYPES","range","type","selected","getPointerStyle","divider","degrees","round","-webkit-transform","-ms-transform","transform","setTimeByDeg","deg","setTime","module","config","$mdIconProvider","mdpIconsRegistry","forEach","icon","id","url","run","$templateCache","put","svg","constant","directive","$mdUtil","restrict","priority","compile","element","inputContainer","getClosest","toggleClass","provider","LABEL_OK","LABEL_CANCEL","DISPLAY_FORMAT","setDisplayFormat","setOKButtonLabel","label","setCancelButtonLabel","$get","datePicker","Date","now","isObject","show","controller","controllerAs","clickOutsideToClose","template","targetEvent","locals","skipHide","$animate","bindToController","link","scope","attrs","ctrl","animElements","querySelector","map","a","direction","addClass","removeClass","$mdpDatePicker","require","transclude","noFloat","isDefined","mdpNoFloat","placeholder","mdpPlaceholder","openOnClick","mdpOpenOnClick","mdpDisabled","dateFormat","disabled","pre","ngModel","$transclude","post","updateInputElement","inputElement","inputContainerCtrl","setHasValue","$isEmpty","updateDate","strValue","$setViewValue","$pristine","messages","hasClass","$render","onInputElementEvents","event","target","$viewVaue","clone","append","model","isError","$invalid","$formatters","unshift","$validators","modelValue","viewValue","required","isUndefined","$parsers","parsed","$modelValue","originalModel","month","showPicker","ev","on","$on","off","replace","timepickerCtrl","$parent","timepicker","onEvent","containerCoords","currentTarget","getClientRects","x","offsetWidth","pageX","left","y","pageY","top","offsetHeight","atan2","PI","indexOf","e","timePicker","$mdpTimePicker","timeFormat","updateTime","$error","setInvalid","Object","keys","seconds"],"mappings":"CAAA,WACA,YA8DA,SAASA,GAAeC,EAAQC,EAAWC,EAAUC,EAAUC,EAAaC,GACxE,GAAIC,GAAOC,IAEXA,MAAKC,KAAOC,OAAOL,GACnBG,KAAKG,QAAUL,EAAQK,SAAWD,OAAOJ,EAAQK,SAASC,UAAYF,OAAOJ,EAAQK,SAAW,KAChGH,KAAKK,QAAUP,EAAQO,SAAWH,OAAOJ,EAAQO,SAASD,UAAYF,OAAOJ,EAAQO,SAAW,KAChGL,KAAKM,cAAgBR,EAAQQ,eAAiB,cAC9CN,KAAKO,WAAaC,QAAQC,WAAWX,EAAQS,YAAcT,EAAQS,WAAa,KAChFP,KAAKU,eAAgB,EAGpBV,KAAKG,SAAWH,KAAKK,SACpBL,KAAKK,QAAQM,SAASX,KAAKG,WAC9BH,KAAKK,QAAUH,OAAOF,KAAKG,SAASS,IAAI,EAAG,SAIzCZ,KAAKC,OAEDD,KAAKG,SAAWH,KAAKC,KAAKU,SAASX,KAAKG,WAC9CH,KAAKC,KAAOC,OAAOF,KAAKG,UAIlBH,KAAKK,SAAWL,KAA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AAO5B,EAAS6B,EAAOuB,EAASC,GAE3C,QAASmC,GAAWC,GAChByB,EAAe9D,EAAQiC,aACnB/D,YAAamE,EACb3I,WAAY8E,EAAM9E,aACnB3C,KAAK,SAAS0C,GACbuG,EAAQU,cAAc/L,OAAO8E,GAAMT,OAAOwF,EAAMxF,SAChDgH,EAAQc,YAPhBtC,EAAMxF,OAASwF,EAAMxF,QAAU,QAW/B4D,EAAQ0F,GAAG,QAASF,GAEpB5D,EAAM+D,IAAI,WAAY,WAClB3F,EAAQ4F,IAAI,QAASJ","file":"mdPickers.min.js","sourcesContent":["(function() {\n\"use strict\";\n/* global moment, angular */\n\nvar module = angular.module(\"mdPickers\", [\n\t\"ngMaterial\",\n\t\"ngAnimate\",\n\t\"ngAria\"\n]);\n\nmodule.config([\"$mdIconProvider\", \"mdpIconsRegistry\", function($mdIconProvider, mdpIconsRegistry) {\n\tangular.forEach(mdpIconsRegistry, function(icon, index) {\n\t\t$mdIconProvider.icon(icon.id, icon.url);\n\t});\n}]);\n\nmodule.run([\"$templateCache\", \"mdpIconsRegistry\", function($templateCache, mdpIconsRegistry) {\n\tangular.forEach(mdpIconsRegistry, function(icon, index) {\n\t\t$templateCache.put(icon.url, icon.svg);\n\t});\n}]);\nmodule.constant(\"mdpIconsRegistry\", [\n {\n id: 'mdp-chevron-left',\n url: 'mdp-chevron-left.svg',\n svg: ''\n },\n {\n id: 'mdp-chevron-right',\n url: 'mdp-chevron-right.svg',\n svg: ''\n },\n {\n id: 'mdp-access-time',\n url: 'mdp-access-time.svg',\n svg: ''\n },\n {\n id: 'mdp-event',\n url: 'mdp-event.svg',\n svg: ''\n }\n]);\nmodule.directive(\"ngMessage\", [\"$mdUtil\", function($mdUtil) {\n return {\n restrict: \"EA\",\n priority: 101,\n compile: function(element) {\n var inputContainer = $mdUtil.getClosest(element, \"mdp-time-picker\", true) ||\n $mdUtil.getClosest(element, \"mdp-date-picker\", true);\n \n // If we are not a child of an input container, don't do anything\n if (!inputContainer) return;\n \n // Add our animation class\n element.toggleClass('md-input-message-animation', true);\n \n return {};\n }\n } \n}]);\n/* global moment, angular */\n\nfunction DatePickerCtrl($scope, $mdDialog, $mdMedia, $timeout, currentDate, options) {\n var self = this;\n\n this.date = moment(currentDate);\n this.minDate = options.minDate && moment(options.minDate).isValid() ? moment(options.minDate) : null;\n this.maxDate = options.maxDate && moment(options.maxDate).isValid() ? moment(options.maxDate) : null;\n this.displayFormat = options.displayFormat || \"ddd, MMM DD\";\n this.dateFilter = angular.isFunction(options.dateFilter) ? options.dateFilter : null;\n this.selectingYear = false;\n \n // validate min and max date\n\tif (this.minDate && this.maxDate) {\n\t\tif (this.maxDate.isBefore(this.minDate)) {\n\t\t\tthis.maxDate = moment(this.minDate).add(1, 'days');\n\t\t}\n\t}\n\t\n\tif (this.date) {\n\t\t// check min date\n \tif (this.minDate && this.date.isBefore(this.minDate)) {\n\t\t\tthis.date = moment(this.minDate);\n \t}\n \t\n \t// check max date\n \tif (this.maxDate && this.date.isAfter(this.maxDate)) {\n\t\t\tthis.date = moment(this.maxDate);\n \t}\n\t}\n\t\n\tthis.yearItems = {\n currentIndex_: 0,\n PAGE_SIZE: 5,\n START: (self.minDate ? self.minDate.year() : 1900),\n END: (self.maxDate ? self.maxDate.year() : 0),\n getItemAtIndex: function(index) {\n \tif(this.currentIndex_ < index)\n this.currentIndex_ = index;\n \t\n \treturn this.START + index;\n },\n getLength: function() {\n return Math.min(\n this.currentIndex_ + Math.floor(this.PAGE_SIZE / 2),\n Math.abs(this.START - this.END) + 1\n );\n }\n };\n\n $scope.$mdMedia = $mdMedia;\n $scope.year = this.date.year();\n\n\tthis.selectYear = function(year) {\n self.date.year(year);\n $scope.year = year;\n self.selectingYear = false;\n self.animate();\n };\n \n this.showYear = function() { \n self.yearTopIndex = (self.date.year() - self.yearItems.START) + Math.floor(self.yearItems.PAGE_SIZE / 2);\n self.yearItems.currentIndex_ = (self.date.year() - self.yearItems.START) + 1;\n self.selectingYear = true;\n };\n \n this.showCalendar = function() {\n self.selectingYear = false;\n };\n\n this.cancel = function() {\n $mdDialog.cancel();\n };\n\n this.confirm = function() {\n \tvar date = this.date;\n \t\n \tif (this.minDate && this.date.isBefore(this.minDate)) {\n \t\tdate = moment(this.minDate);\n \t}\n \t\n \tif (this.maxDate && this.date.isAfter(this.maxDate)) {\n \t\tdate = moment(this.maxDate);\n \t} \t\n \t\n $mdDialog.hide(date.toDate());\n };\n \n this.animate = function() {\n self.animating = true;\n $timeout(angular.noop).then(function() {\n self.animating = false;\n }) \n };\n}\n\nmodule.provider(\"$mdpDatePicker\", function() {\n var LABEL_OK = \"OK\",\n LABEL_CANCEL = \"Cancel\",\n DISPLAY_FORMAT = \"ddd, MMM DD\";\n \n this.setDisplayFormat = function(format) {\n DISPLAY_FORMAT = format; \n };\n \n this.setOKButtonLabel = function(label) {\n LABEL_OK = label;\n };\n \n this.setCancelButtonLabel = function(label) {\n LABEL_CANCEL = label;\n };\n \n this.$get = [\"$mdDialog\", function($mdDialog) {\n var datePicker = function(currentDate, options) {\n if (!angular.isDate(currentDate)) currentDate = Date.now();\n if (!angular.isObject(options)) options = {};\n \n options.displayFormat = DISPLAY_FORMAT;\n \n return $mdDialog.show({\n controller: ['$scope', '$mdDialog', '$mdMedia', '$timeout', 'currentDate', 'options', DatePickerCtrl],\n controllerAs: 'datepicker',\n clickOutsideToClose: true,\n template: '' +\n '' +\n '
' +\n '' +\n '{{ datepicker.date.format(\\'YYYY\\') }}' +\n '{{ datepicker.date.format(datepicker.displayFormat) }} ' +\n '' + \n '
' + \n '
' + \n '
' +\n '' +\n '
' +\n '{{ item }}' +\n '
' +\n '
' +\n '
' +\n '' +\n '' +\n \t'' +\n '' + LABEL_CANCEL + '' +\n '' + LABEL_OK + '' +\n '' +\n '
' +\n '
' +\n '
',\n targetEvent: options.targetEvent,\n locals: {\n currentDate: currentDate,\n options: options\n },\n skipHide: true\n });\n };\n \n return datePicker;\n }];\n});\n\nfunction CalendarCtrl($scope) {\n\tvar self = this;\n\n this.$onInit = function () {\n self.daysInMonth = [];\n self.dow = moment.localeData().firstDayOfWeek();\n self.weekDays = [].concat(\n moment.weekdaysMin().slice(self.dow),\n moment.weekdaysMin().slice(0, self.dow)\n );\n $scope.$watch(function () {\n return self.date.unix()\n }, function (newValue, oldValue) {\n if (newValue && newValue !== oldValue)\n self.updateDaysInMonth();\n });\n self.updateDaysInMonth();\n };\n\n this.getDaysInMonth = function() {\n var days = self.date.daysInMonth(),\n firstDay = moment(self.date).date(1).day() - this.dow;\n \n if(firstDay < 0) firstDay = this.weekDays.length - 1;\n \n\n var arr = [];\n for(var i = 1; i <= (firstDay + days); i++) {\n var day = null;\n if(i > firstDay) {\n day = {\n value: (i - firstDay),\n enabled: self.isDayEnabled(moment(self.date).date(i - firstDay).toDate())\n };\n }\n arr.push(day);\n }\n \n return arr;\n };\n \n this.isDayEnabled = function(day) {\n return (!this.minDate || this.minDate <= day) && \n (!this.maxDate || this.maxDate >= day) && \n (!self.dateFilter || !self.dateFilter(day));\n };\n \n this.selectDate = function(dom) {\n self.date.date(dom);\n };\n\n this.nextMonth = function() {\n self.date.add(1, 'months');\n };\n\n this.prevMonth = function() {\n self.date.subtract(1, 'months');\n };\n \n this.updateDaysInMonth = function() {\n self.daysInMonth = self.getDaysInMonth();\n };\n\n $scope.$watch(function() { return self.date.unix() }, function(newValue, oldValue) {\n if(newValue && newValue !== oldValue)\n self.updateDaysInMonth();\n });\n}\n\nmodule.directive(\"mdpCalendar\", [\"$animate\", function($animate) {\n return {\n restrict: 'E',\n bindToController: {\n \"date\": \"=\",\n \"minDate\": \"=\",\n \"maxDate\": \"=\",\n \"dateFilter\": \"=\"\n },\n template: '
' +\n '
' +\n '' +\n '
{{ calendar.date.format(\"MMMM YYYY\") }}
' +\n '' +\n '
' +\n '
' +\n '
{{ d }}
' +\n '
' +\n '
' +\n '
' +\n '{{ day.value }}' +\n '
' +\n '
' +\n '
' +\n '
',\n controller: [\"$scope\", CalendarCtrl],\n controllerAs: \"calendar\",\n link: function(scope, element, attrs, ctrl) {\n var animElements = [\n element[0].querySelector(\".mdp-calendar-week-days\"),\n element[0].querySelector('.mdp-calendar-days'),\n element[0].querySelector('.mdp-calendar-monthyear')\n ].map(function(a) {\n return angular.element(a); \n });\n \n scope.$watch(function() { return ctrl.date.format(\"YYYYMM\") }, function(newValue, oldValue) {\n var direction = null;\n \n if(newValue > oldValue)\n direction = \"mdp-animate-next\";\n else if(newValue < oldValue)\n direction = \"mdp-animate-prev\";\n \n if(direction) {\n for(var i in animElements) {\n animElements[i].addClass(direction);\n $animate.removeClass(animElements[i], direction);\n }\n }\n });\n }\n }\n}]);\n\nfunction formatValidator(value, format) {\n return !value || angular.isDate(value) || moment(value, format, true).isValid();\n}\n\nfunction minDateValidator(value, format, minDate) {\n var minDate = moment(minDate, \"YYYY-MM-DD\", true);\n var date = angular.isDate(value) ? moment(value) : moment(value, format, true);\n \n return !value || \n angular.isDate(value) || \n !minDate.isValid() || \n date.isSameOrAfter(minDate);\n}\n\nfunction maxDateValidator(value, format, maxDate) {\n var maxDate = moment(maxDate, \"YYYY-MM-DD\", true);\n var date = angular.isDate(value) ? moment(value) : moment(value, format, true);\n \n return !value || \n angular.isDate(value) || \n !maxDate.isValid() || \n date.isSameOrBefore(maxDate);\n}\n\nfunction filterValidator(value, format, filter) {\n var date = angular.isDate(value) ? moment(value) : moment(value, format, true);\n \n return !value || \n angular.isDate(value) || \n !angular.isFunction(filter) || \n !filter(date);\n}\n\nfunction requiredValidator(value, ngModel) {\n return value\n}\n\nmodule.directive(\"mdpDatePicker\", [\"$mdpDatePicker\", \"$timeout\", function($mdpDatePicker, $timeout) {\n return {\n restrict: 'E',\n require: 'ngModel',\n transclude: true,\n template: function(element, attrs) {\n var noFloat = angular.isDefined(attrs.mdpNoFloat),\n placeholder = angular.isDefined(attrs.mdpPlaceholder) ? attrs.mdpPlaceholder : \"\",\n openOnClick = angular.isDefined(attrs.mdpOpenOnClick) ? true : false;\n \n return '
' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
';\n },\n scope: {\n \"minDate\": \"=mdpMinDate\",\n \"maxDate\": \"=mdpMaxDate\",\n \"dateFilter\": \"=mdpDateFilter\",\n \"dateFormat\": \"@mdpFormat\",\n \"placeholder\": \"@mdpPlaceholder\",\n \"noFloat\": \"=mdpNoFloat\",\n \"openOnClick\": \"=mdpOpenOnClick\",\n \"disabled\": \"=?mdpDisabled\"\n },\n link: {\n pre: function(scope, element, attrs, ngModel, $transclude) {\n \n },\n post: function(scope, element, attrs, ngModel, $transclude) {\n var inputElement = angular.element(element[0].querySelector('input')),\n inputContainer = angular.element(element[0].querySelector('md-input-container')),\n inputContainerCtrl = inputContainer.controller(\"mdInputContainer\");\n \n $transclude(function(clone) {\n inputContainer.append(clone); \n }); \n \n var messages = angular.element(inputContainer[0].querySelector(\"[ng-messages]\"));\n \n scope.type = scope.dateFormat ? \"text\" : \"date\"\n scope.dateFormat = scope.dateFormat || \"YYYY-MM-DD\";\n scope.model = ngModel;\n \n scope.isError = function() {\n return !ngModel.$pristine && !!ngModel.$invalid;\n };\n \n // update input element if model has changed\n ngModel.$formatters.unshift(function(value) {\n var date = angular.isDate(value) && moment(value);\n if(date && date.isValid()) \n updateInputElement(date.format(scope.dateFormat));\n else\n updateInputElement(null);\n });\n \n ngModel.$validators.format = function(modelValue, viewValue) {\n return formatValidator(viewValue, scope.dateFormat);\n };\n \n ngModel.$validators.minDate = function(modelValue, viewValue) {\n return minDateValidator(viewValue, scope.dateFormat, scope.minDate);\n };\n \n ngModel.$validators.maxDate = function(modelValue, viewValue) {\n return maxDateValidator(viewValue, scope.dateFormat, scope.maxDate);\n };\n \n ngModel.$validators.filter = function(modelValue, viewValue) {\n return filterValidator(viewValue, scope.dateFormat, scope.dateFilter);\n };\n \n ngModel.$validators.required = function(modelValue, viewValue) {\n return angular.isUndefined(attrs.required) || !ngModel.$isEmpty(modelValue) || !ngModel.$isEmpty(viewValue);\n };\n \n ngModel.$parsers.unshift(function(value) {\n var parsed = moment(value, scope.dateFormat, true);\n if(parsed.isValid()) {\n if(angular.isDate(ngModel.$modelValue)) {\n var originalModel = moment(ngModel.$modelValue);\n originalModel.year(parsed.year());\n originalModel.month(parsed.month());\n originalModel.date(parsed.date());\n \n parsed = originalModel;\n }\n return parsed.toDate(); \n } else\n return null;\n });\n \n // update input element value\n function updateInputElement(value) {\n inputElement[0].value = value;\n inputContainerCtrl.setHasValue(!ngModel.$isEmpty(value));\n }\n \n function updateDate(date) {\n var value = moment(date, angular.isDate(date) ? null : scope.dateFormat, true),\n strValue = value.format(scope.dateFormat);\n \n if(value.isValid()) {\n updateInputElement(strValue);\n ngModel.$setViewValue(strValue);\n } else {\n updateInputElement(date);\n ngModel.$setViewValue(date);\n }\n \n if(!ngModel.$pristine && \n messages.hasClass(\"md-auto-hide\") && \n inputContainer.hasClass(\"md-input-invalid\")) messages.removeClass(\"md-auto-hide\");\n \n ngModel.$render();\n }\n \n scope.showPicker = function(ev) {\n $mdpDatePicker(ngModel.$modelValue, {\n \t minDate: scope.minDate, \n \t maxDate: scope.maxDate,\n \t dateFilter: scope.dateFilter,\n \t targetEvent: ev\n \t }).then(updateDate);\n };\n \n function onInputElementEvents(event) {\n if(event.target.value !== ngModel.$viewVaue)\n updateDate(event.target.value);\n }\n \n inputElement.on(\"reset input blur\", onInputElementEvents);\n \n scope.$on(\"$destroy\", function() {\n inputElement.off(\"reset input blur\", onInputElementEvents);\n });\n }\n }\n };\n}]);\n\n\nmodule.directive(\"mdpDatePicker\", [\"$mdpDatePicker\", \"$timeout\", function($mdpDatePicker, $timeout) {\n return {\n restrict: 'A',\n require: 'ngModel',\n scope: {\n \"minDate\": \"@min\",\n \"maxDate\": \"@max\",\n \"dateFilter\": \"=mdpDateFilter\",\n \"dateFormat\": \"@mdpFormat\",\n },\n link: function(scope, element, attrs, ngModel, $transclude) {\n scope.dateFormat = scope.dateFormat || \"YYYY-MM-DD\";\n \n ngModel.$validators.format = function(modelValue, viewValue) {\n return formatValidator(viewValue, scope.format);\n };\n \n ngModel.$validators.minDate = function(modelValue, viewValue) {\n return minDateValidator(viewValue, scope.format, scope.minDate);\n };\n \n ngModel.$validators.maxDate = function(modelValue, viewValue) {\n return maxDateValidator(viewValue, scope.format, scope.maxDate);\n };\n \n ngModel.$validators.filter = function(modelValue, viewValue) {\n return filterValidator(viewValue, scope.format, scope.dateFilter);\n };\n \n function showPicker(ev) {\n $mdpDatePicker(ngModel.$modelValue, {\n \t minDate: scope.minDate, \n \t maxDate: scope.maxDate,\n \t dateFilter: scope.dateFilter,\n \t targetEvent: ev\n \t }).then(function(time) {\n ngModel.$setViewValue(moment(time).format(scope.format));\n ngModel.$render();\n });\n };\n \n element.on(\"click\", showPicker);\n \n scope.$on(\"$destroy\", function() {\n element.off(\"click\", showPicker);\n });\n }\n }\n}]);\n/* global moment, angular */\n\nfunction TimePickerCtrl($scope, $mdDialog, time, autoSwitch, $mdMedia) {\n\tvar self = this;\n this.VIEW_HOURS = 1;\n this.VIEW_MINUTES = 2;\n this.currentView = this.VIEW_HOURS;\n this.time = moment(time);\n this.autoSwitch = !!autoSwitch;\n \n this.clockHours = parseInt(this.time.format(\"h\"));\n this.clockMinutes = parseInt(this.time.minutes());\n \n\t$scope.$mdMedia = $mdMedia;\n\t\n\tthis.switchView = function() {\n\t self.currentView = self.currentView == self.VIEW_HOURS ? self.VIEW_MINUTES : self.VIEW_HOURS;\n\t};\n \n\tthis.setAM = function() {\n if(self.time.hours() >= 12)\n self.time.hour(self.time.hour() - 12);\n\t};\n \n this.setPM = function() {\n if(self.time.hours() < 12)\n self.time.hour(self.time.hour() + 12);\n\t};\n \n this.cancel = function() {\n $mdDialog.cancel();\n };\n\n this.confirm = function() {\n $mdDialog.hide(this.time.toDate());\n };\n}\n\nfunction ClockCtrl($scope) {\n var self = this;\n var TYPE_HOURS = \"hours\";\n var TYPE_MINUTES = \"minutes\";\n\n this.$onInit = function () {\n self.STEP_DEG = 360 / 12;\n self.steps = [];\n self.CLOCK_TYPES = {\n \"hours\": { range: 12, },\n \"minutes\": { range: 60, }\n };\n self.type = self.type || \"hours\";\n switch (self.type) {\n case TYPE_HOURS:\n for (var i = 1; i <= 12; i++)\n self.steps.push(i);\n self.selected = self.time.hours() || 0;\n if (self.selected > 12) self.selected -= 12;\n\n break;\n case TYPE_MINUTES:\n for (var i = 5; i <= 55; i += 5)\n self.steps.push(i);\n self.steps.push(0);\n self.selected = self.time.minutes() || 0;\n break;\n }\n };\n \n this.getPointerStyle = function() {\n var divider = 1;\n switch(self.type) {\n case TYPE_HOURS:\n divider = 12;\n break;\n case TYPE_MINUTES:\n divider = 60;\n break;\n } \n var degrees = Math.round(self.selected * (360 / divider)) - 180;\n return { \n \"-webkit-transform\": \"rotate(\" + degrees + \"deg)\",\n \"-ms-transform\": \"rotate(\" + degrees + \"deg)\",\n \"transform\": \"rotate(\" + degrees + \"deg)\"\n }\n };\n \n this.setTimeByDeg = function(deg) {\n deg = deg >= 360 ? 0 : deg;\n var divider = 0;\n switch(self.type) {\n case TYPE_HOURS:\n divider = 12;\n break;\n case TYPE_MINUTES:\n divider = 60;\n break;\n } \n \n self.setTime(\n Math.round(divider / 360 * deg)\n );\n };\n \n this.setTime = function(time, type) {\n this.selected = time;\n \n switch(self.type) {\n case TYPE_HOURS:\n if(self.time.format(\"A\") == \"PM\") time += 12;\n this.time.hours(time);\n break;\n case TYPE_MINUTES:\n if(time > 59) time -= 60;\n this.time.minutes(time);\n break;\n }\n \n };\n}\n\nmodule.directive(\"mdpClock\", [\"$animate\", \"$timeout\", function($animate, $timeout) {\n return {\n restrict: 'E',\n bindToController: {\n 'type': '@?',\n 'time': '=',\n 'autoSwitch': '=?'\n },\n replace: true,\n template: '
' +\n '
' +\n '' +\n '' +\n '' +\n '' +\n '{{ step }}' +\n '
' +\n '
',\n controller: [\"$scope\", ClockCtrl],\n controllerAs: \"clock\",\n link: function(scope, element, attrs, ctrl) {\n var pointer = angular.element(element[0].querySelector(\".mdp-pointer\")),\n timepickerCtrl = scope.$parent.timepicker;\n \n var onEvent = function(event) {\n var containerCoords = event.currentTarget.getClientRects()[0];\n var x = ((event.currentTarget.offsetWidth / 2) - (event.pageX - containerCoords.left)),\n y = ((event.pageY - containerCoords.top) - (event.currentTarget.offsetHeight / 2));\n\n var deg = Math.round((Math.atan2(x, y) * (180 / Math.PI)));\n $timeout(function() {\n ctrl.setTimeByDeg(deg + 180);\n if(ctrl.autoSwitch && [\"mouseup\", \"click\"].indexOf(event.type) !== -1 && timepickerCtrl) timepickerCtrl.switchView();\n });\n }; \n \n element.on(\"mousedown\", function() {\n element.on(\"mousemove\", onEvent);\n });\n \n element.on(\"mouseup\", function(e) {\n element.off(\"mousemove\");\n });\n \n element.on(\"click\", onEvent);\n scope.$on(\"$destroy\", function() {\n element.off(\"click\", onEvent);\n element.off(\"mousemove\", onEvent); \n });\n }\n }\n}]);\n\nmodule.provider(\"$mdpTimePicker\", function() {\n var LABEL_OK = \"OK\",\n LABEL_CANCEL = \"Cancel\";\n \n this.setOKButtonLabel = function(label) {\n LABEL_OK = label;\n };\n \n this.setCancelButtonLabel = function(label) {\n LABEL_CANCEL = label;\n };\n \n this.$get = [\"$mdDialog\", function($mdDialog) {\n var timePicker = function(time, options) {\n if(!angular.isDate(time)) time = Date.now();\n if (!angular.isObject(options)) options = {};\n \n return $mdDialog.show({\n controller: ['$scope', '$mdDialog', 'time', 'autoSwitch', '$mdMedia', TimePickerCtrl],\n controllerAs: 'timepicker',\n clickOutsideToClose: true,\n template: '' +\n '' +\n '' +\n '
' +\n '{{ timepicker.time.format(\"h\") }}:' + \n '{{ timepicker.time.format(\"mm\") }}' +\n '
' +\n '
' + \n 'AM' +\n '= 12 }\">PM' +\n '
' + \n '
' +\n '
' +\n '
' +\n\t '' +\n\t '' +\n '
' +\n \n '' +\n\t \t'' +\n '' + LABEL_CANCEL + '' +\n '' + LABEL_OK + '' +\n '' +\n '
' +\n '
' +\n '
',\n targetEvent: options.targetEvent,\n locals: {\n time: time,\n autoSwitch: options.autoSwitch\n },\n skipHide: true\n });\n };\n \n return timePicker;\n }];\n});\n\nmodule.directive(\"mdpTimePicker\", [\"$mdpTimePicker\", \"$timeout\", function($mdpTimePicker, $timeout) {\n return {\n restrict: 'E',\n require: 'ngModel',\n transclude: true,\n template: function(element, attrs) {\n var noFloat = angular.isDefined(attrs.mdpNoFloat),\n placeholder = angular.isDefined(attrs.mdpPlaceholder) ? attrs.mdpPlaceholder : \"\",\n openOnClick = angular.isDefined(attrs.mdpOpenOnClick) ? true : false;\n \n return '
' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '' +\n '
';\n },\n scope: {\n \"timeFormat\": \"@mdpFormat\",\n \"placeholder\": \"@mdpPlaceholder\",\n \"autoSwitch\": \"=?mdpAutoSwitch\",\n \"disabled\": \"=?mdpDisabled\"\n },\n link: function(scope, element, attrs, ngModel, $transclude) {\n var inputElement = angular.element(element[0].querySelector('input')),\n inputContainer = angular.element(element[0].querySelector('md-input-container')),\n inputContainerCtrl = inputContainer.controller(\"mdInputContainer\");\n \n $transclude(function(clone) {\n inputContainer.append(clone); \n });\n \n var messages = angular.element(inputContainer[0].querySelector(\"[ng-messages]\"));\n \n scope.type = scope.timeFormat ? \"text\" : \"time\"\n scope.timeFormat = scope.timeFormat || \"HH:mm\";\n scope.autoSwitch = scope.autoSwitch || false;\n \n scope.$watch(function() { return ngModel.$error }, function(newValue, oldValue) {\n inputContainerCtrl.setInvalid(!ngModel.$pristine && !!Object.keys(ngModel.$error).length);\n }, true);\n \n // update input element if model has changed\n ngModel.$formatters.unshift(function(value) {\n var time = angular.isDate(value) && moment(value);\n if(time && time.isValid()) \n updateInputElement(time.format(scope.timeFormat));\n else\n updateInputElement(null);\n });\n \n ngModel.$validators.format = function(modelValue, viewValue) {\n return !viewValue || angular.isDate(viewValue) || moment(viewValue, scope.timeFormat, true).isValid();\n };\n \n ngModel.$validators.required = function(modelValue, viewValue) {\n return angular.isUndefined(attrs.required) || !ngModel.$isEmpty(modelValue) || !ngModel.$isEmpty(viewValue);\n };\n \n ngModel.$parsers.unshift(function(value) {\n var parsed = moment(value, scope.timeFormat, true);\n if(parsed.isValid()) {\n if(angular.isDate(ngModel.$modelValue)) {\n var originalModel = moment(ngModel.$modelValue);\n originalModel.minutes(parsed.minutes());\n originalModel.hours(parsed.hours());\n originalModel.seconds(parsed.seconds());\n \n parsed = originalModel;\n }\n return parsed.toDate(); \n } else\n return null;\n });\n \n // update input element value\n function updateInputElement(value) {\n inputElement[0].value = value;\n inputContainerCtrl.setHasValue(!ngModel.$isEmpty(value));\n }\n \n function updateTime(time) {\n var value = moment(time, angular.isDate(time) ? null : scope.timeFormat, true),\n strValue = value.format(scope.timeFormat);\n\n if(value.isValid()) {\n updateInputElement(strValue);\n ngModel.$setViewValue(strValue);\n } else {\n updateInputElement(time);\n ngModel.$setViewValue(time);\n }\n \n if(!ngModel.$pristine && \n messages.hasClass(\"md-auto-hide\") && \n inputContainer.hasClass(\"md-input-invalid\")) messages.removeClass(\"md-auto-hide\");\n \n ngModel.$render();\n }\n \n scope.showPicker = function(ev) {\n $mdpTimePicker(ngModel.$modelValue, {\n targetEvent: ev,\n autoSwitch: scope.autoSwitch\n }).then(function(time) {\n updateTime(time, true);\n });\n };\n \n function onInputElementEvents(event) {\n if(event.target.value !== ngModel.$viewVaue)\n updateTime(event.target.value);\n }\n \n inputElement.on(\"reset input blur\", onInputElementEvents);\n \n scope.$on(\"$destroy\", function() {\n inputElement.off(\"reset input blur\", onInputElementEvents);\n })\n }\n };\n}]);\n\nmodule.directive(\"mdpTimePicker\", [\"$mdpTimePicker\", \"$timeout\", function($mdpTimePicker, $timeout) {\n return {\n restrict: 'A',\n require: 'ngModel',\n scope: {\n \"timeFormat\": \"@mdpFormat\",\n \"autoSwitch\": \"=?mdpAutoSwitch\",\n },\n link: function(scope, element, attrs, ngModel, $transclude) {\n scope.format = scope.format || \"HH:mm\";\n function showPicker(ev) {\n $mdpTimePicker(ngModel.$modelValue, {\n targetEvent: ev,\n autoSwitch: scope.autoSwitch\n }).then(function(time) {\n ngModel.$setViewValue(moment(time).format(scope.format));\n ngModel.$render();\n });\n };\n \n element.on(\"click\", showPicker);\n \n scope.$on(\"$destroy\", function() {\n element.off(\"click\", showPicker);\n });\n }\n }\n}]);\n\n})();"]} \ No newline at end of file diff --git a/src/components/mdpDatePicker/mdpDatePicker.js b/src/components/mdpDatePicker/mdpDatePicker.js index a4301812..e37cb30e 100644 --- a/src/components/mdpDatePicker/mdpDatePicker.js +++ b/src/components/mdpDatePicker/mdpDatePicker.js @@ -162,20 +162,23 @@ module.provider("$mdpDatePicker", function() { function CalendarCtrl($scope) { var self = this; - this.dow = moment.localeData().firstDayOfWeek(); - - this.weekDays = [].concat( - moment.weekdaysMin().slice( - this.dow - ), - moment.weekdaysMin().slice( - 0, - this.dow - ) - ); - - this.daysInMonth = []; - + + this.$onInit = function () { + self.daysInMonth = []; + self.dow = moment.localeData().firstDayOfWeek(); + self.weekDays = [].concat( + moment.weekdaysMin().slice(self.dow), + moment.weekdaysMin().slice(0, self.dow) + ); + $scope.$watch(function () { + return self.date.unix() + }, function (newValue, oldValue) { + if (newValue && newValue !== oldValue) + self.updateDaysInMonth(); + }); + self.updateDaysInMonth(); + }; + this.getDaysInMonth = function() { var days = self.date.daysInMonth(), firstDay = moment(self.date).date(1).day() - this.dow; @@ -219,13 +222,11 @@ function CalendarCtrl($scope) { this.updateDaysInMonth = function() { self.daysInMonth = self.getDaysInMonth(); }; - + $scope.$watch(function() { return self.date.unix() }, function(newValue, oldValue) { if(newValue && newValue !== oldValue) self.updateDaysInMonth(); - }) - - self.updateDaysInMonth(); + }); } module.directive("mdpCalendar", ["$animate", function($animate) { diff --git a/src/components/mdpTimePicker/mdpTimePicker.js b/src/components/mdpTimePicker/mdpTimePicker.js index 249ea008..b6299c77 100644 --- a/src/components/mdpTimePicker/mdpTimePicker.js +++ b/src/components/mdpTimePicker/mdpTimePicker.js @@ -37,21 +37,34 @@ function TimePickerCtrl($scope, $mdDialog, time, autoSwitch, $mdMedia) { } function ClockCtrl($scope) { + var self = this; var TYPE_HOURS = "hours"; var TYPE_MINUTES = "minutes"; - var self = this; - - this.STEP_DEG = 360 / 12; - this.steps = []; - - this.CLOCK_TYPES = { - "hours": { - range: 12, - }, - "minutes": { - range: 60, + + this.$onInit = function () { + self.STEP_DEG = 360 / 12; + self.steps = []; + self.CLOCK_TYPES = { + "hours": { range: 12, }, + "minutes": { range: 60, } + }; + self.type = self.type || "hours"; + switch (self.type) { + case TYPE_HOURS: + for (var i = 1; i <= 12; i++) + self.steps.push(i); + self.selected = self.time.hours() || 0; + if (self.selected > 12) self.selected -= 12; + + break; + case TYPE_MINUTES: + for (var i = 5; i <= 55; i += 5) + self.steps.push(i); + self.steps.push(0); + self.selected = self.time.minutes() || 0; + break; } - } + }; this.getPointerStyle = function() { var divider = 1; @@ -103,28 +116,6 @@ function ClockCtrl($scope) { } }; - - this.init = function() { - self.type = self.type || "hours"; - switch(self.type) { - case TYPE_HOURS: - for(var i = 1; i <= 12; i++) - self.steps.push(i); - self.selected = self.time.hours() || 0; - if(self.selected > 12) self.selected -= 12; - - break; - case TYPE_MINUTES: - for(var i = 5; i <= 55; i+=5) - self.steps.push(i); - self.steps.push(0); - self.selected = self.time.minutes() || 0; - - break; - } - }; - - this.init(); } module.directive("mdpClock", ["$animate", "$timeout", function($animate, $timeout) {