diff --git a/README.md b/README.md index 1d49b29..1ecea0e 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,8 @@ The directive accepts several attributes which are described below: | **edit-input** | Boolean | true => Input editable and don't show dialog (default: false) | | **click-outside-to-close**| Boolean | true => A click outside close the dialog (default: false) | | **minute-steps** | Number | 1 to 59 minute steps (default: 5) | -| **show-icon** | Boolean | true => Show calendar or time icon before + clear (default: false) | +| **show-icon** | Boolean | true => Show calendar or time icon before (default: false) | +| **show-clear** | Boolean | true => clear (default: true if show-icon) | | **template-url** | String | You can set a custom HTML template (default: '') | | **ng-model-options** | timezone option | For example: ng-model-options="{timezone: 'utc'}" | | **day-of-week-len** | Number | Day of the week length (default: 1 => S) Possible value 0-3 | @@ -216,7 +217,8 @@ The `mdcDateTimeDialog.show` accepts almost the same options as the directive. editInput: {boolean} =false, clickOutsideToClose: {boolean} =false, minuteSteps: {int} =5, - howIcon: {boolean} =false, + showIcon: {boolean} =false, + showClear: {boolean} =true, templateUrl: {string} ='' targetEvent: {DOMClickEvent}=null, openFrom: {string|Element|object}=null, diff --git a/dist/angular-material-datetimepicker.min.js b/dist/angular-material-datetimepicker.min.js index 5d98a1a..978fda7 100644 --- a/dist/angular-material-datetimepicker.min.js +++ b/dist/angular-material-datetimepicker.min.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(p){var e="ngMaterialDatePicker",a={DATE:0,HOUR:1,MINUTE:2},$=function(e,t){return e=angular.element(e),"getComputedStyle"in window?window.getComputedStyle(e[0])[t]:e.css(t)},h='
{{picker.currentNearestMinute().format("dddd")}}
{{picker.params.shortTime?picker.currentDate.format("A"):" "}}
×
{{picker.currentDate.format("MMM")|uppercase}}
{{itemMonth}}
{{picker.currentDate.format("DD")}}
{{picker.currentDate.format("YYYY")}}
{{itemYear}}
{{picker.currentNearestMinute().format(picker.params.shortTime ? "hh":"HH")}}:{{picker.currentNearestMinute().format("mm")}} {{picker.currentNearestMinute().format(picker.params.shortTime ? "hh":"HH")}}:{{picker.currentNearestMinute().format("mm")}}:{{picker.currentNearestMinute().format("ss")}} {{picker.currentDate.format("A")}}
{{picker.currentNearestMinute().format(picker.params.shortTime?"hh":"HH")}}:{{picker.currentNearestMinute().format("mm")}}
{{picker.currentNearestMinute().format(picker.params.shortTime?"hh":"HH")}}:{{picker.currentNearestMinute().format("mm")}}:{{picker.currentNearestMinute().format("ss")}}
{{::picker.params.todayText}} {{::picker.params.cancelText}} {{::picker.params.okText}}
';angular.module(e,["ngMaterial"]).factory("mdcDefaultParams",function(){var a={date:!0,time:!0,minutes:!0,seconds:!1,format:"YYYY-MM-DD",minDate:null,maxDate:null,currentDate:null,lang:window.navigator.userLanguage||window.navigator.language||"en",weekStart:0,shortTime:!1,cancelText:"Cancel",okText:"OK",amText:"AM",pmText:"PM",todayBtn:!0,todayText:"Today",disableDates:[],weekDays:!1,disableParentScroll:!1,autoOk:!1,editInput:!1,clickOutsideToClose:!1,minuteSteps:5,showIcon:!1,template:h,templateUrl:"",targetEvent:null,openFrom:null,closeTo:null,dayOfWeekLen:1,hasBackdrop:!0};return function(e){if(e)for(var t in e)a.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(a[t]=e[t]);return a}}).directive("mdcDatetimePicker",["$mdDialog","$timeout","$compile",function(u,m,i){return{restrict:"A",require:"ngModel",scope:{currentDate:"=ngModel",ngModelOptions:"=",ngChange:"&",time:"=",date:"=",minutes:"=",seconds:"=",minDate:"=",maxDate:"=",disableDates:"=",weekDays:"=",shortTime:"=",weekStart:"=",format:"@",cancelText:"@",okText:"@",lang:"@",amText:"@",pmText:"@",showTodaysDate:"@",todayBtn:"=",todayText:"@",disableParentScroll:"=",autoOk:"=",editInput:"=",clickOutsideToClose:"=",minuteSteps:"=",showIcon:"=",templateUrl:"@",dayOfWeekLen:"=",hasBackdrop:"="},link:function(n,r,s,c){var o=!1;n.format||(n.date&&n.time&&n.seconds?n.format="YYYY-MM-DD HH:mm:ss":n.date&&n.time?n.format="YYYY-MM-DD HH:mm":n.date?n.format="YYYY-MM-DD":n.format="HH:mm");var d,l=null;if(void 0!==n.showTodaysDate&&"false"!==n.showTodaysDate&&(l=p()),angular.isString(n.currentDate)&&""!==n.currentDate&&(n.currentDate=p(n.currentDate,n.format)),c){var e={"*":"$inherit",debounce:500};1===angular.version.major&&5';r.after(i(a+'')(n)),n.openCalendarDiag=function(e){t(e)},n.clear=function(){c.$setViewValue(null),n.currentDate=null,c.$render(),m(function(){n.ngChange(),r[0].focus()},0,!1)}}}}}]).factory("mdcDateTimeDialog",["$mdDialog","$q",function(i,n){return{show:function(e){var t=n.defer();void 0!==e.showTodaysDate&&"false"!==e.showTodaysDate&&(e.showTodaysDate=p());var a={controller:f,controllerAs:"picker",locals:{options:e},parent:angular.element(document.body),bindToController:!0,clickOutsideToClose:e.clickOutsideToClose||!1,disableParentScroll:e.disableParentScroll||!1,skipHide:!0,multiple:!0,hasBackdrop:void 0===e.hasBackdrop||e.hasBackdrop,targetEvent:e.targetEvent,openFrom:e.openFrom,closeTo:e.closeTo};return e.templateUrl?a.templateUrl=e.templateUrl:a.template=h,i.show(a).then(function(e){t.resolve(e&&!e._isUTC?e.toDate():e)},function(){t.reject()}),t.promise}}}]);var f=function(e,t){this.currentView=a.DATE,this._dialog=e,this._attachedEvents=[],this.VIEWS=a,this.params=angular.copy(t()),this.meridien="AM",this.params=angular.extend(this.params,this.options),this.init()};return f.$inject=["$mdDialog","mdcDefaultParams"],f.prototype={init:function(){this.timeMode=this.params.time&&!this.params.date,this.dateMode=this.params.date,this.initDates(),this.start()},currentNearestMinute:function(){var e=this.params.minuteSteps;(e<1||59=parseInt(n.format("X"))}return i},isBeforeMaxDate:function(e,t,a){var i=!0;if(void 0!==this.maxDate&&null!==this.maxDate){var n=p(this.maxDate),r=p(e);t||a||(n.hour(0),n.minute(0),r.hour(0),r.minute(0)),n.second(0),r.second(0),n.millisecond(0),r.millisecond(0),a||(r.minute(0),n.minute(0)),i=parseInt(r.format("X"))<=parseInt(n.format("X"))}return i},isInDisableDates:function(e){var t=e.format("MMMM Do YYYY");return!(-1
'}}]).directive("mdcDatetimePickerCalendarMonth",["$compile",function(s){var r=function(e,t){var a=angular.element(e[0].querySelector("tbody")),n=t.cal,i=t.month,r=[];i.days.forEach(function(e,i){r.push(""),e.forEach(function(e,t){if(r.push(""),e)if(n.isInRange(e)){var a="month['days']["+i+"]["+t+"]";r.push(''),r.push(e.format("D")),r.push("")}else r.push(''),r.push(e.format("D")),r.push("");r.push("")}),r.push("")}),a.html(r.join("")),s(a)(t)};return{scope:{idx:"="},require:"^mdcDatetimePickerCalendar",restrict:"AE",template:'
{{month.name}}
{{cal.toDay(day)}}
',link:function(a,i,e,n){a.cal=n,a.month=n.getItemAtIndex(parseInt(a.idx)),r(i,a),a.$watch(function(){return a.idx},function(e,t){e!=t&&(a.month=n.getItemAtIndex(parseInt(a.idx)),r(i,a))})}}}]),angular.module(e).directive("mdcDtpNoclick",function(){return{link:function(e,t){t.on("click",function(e){e.preventDefault()})}}}),angular.module(e).directive("mdcDatetimePickerClock",["$timeout",function(o){return{restrict:"E",template:'',link:function(S,V,O){var E="minutes"===O.mode,N="seconds"===O.mode,Y=S.picker,P=document.querySelector("md-dialog.dtp"),c="ontouchstart"in window,e={POINTER_DOWN:c?"touchstart":"mousedown",POINTER_UP:c?"touchend":"mouseup",POINTER_MOVE:c?"touchmove":"mousemove"},t=function(e){e.preventDefault();var t=e.currentTarget.closest("div"),a=t.getClientRects()[0];c&&(e=e.changedTouches[0]);var i=t.offsetWidth/2-(e.pageX-a.left),n=e.pageY-a.top-t.offsetHeight/2,r=Math.sqrt(Math.pow(i,2)+Math.pow(n,2)),s=Math.round(Math.atan2(i,n)*(180/Math.PI));o(function(){!function(e,t){var a=0;if(0!==(e=360<=e?0:e)){var i=E||N?60:12;a=Math.round(i/360*e)}if(E){var n=Y.params.minuteSteps;(n<1||59{{::picker.params.amText}}
{{picker.currentNearestMinute().format(picker.params.shortTime?"hh":"HH")}}:{{picker.currentNearestMinute().format("mm")}}
{{picker.currentNearestMinute().format(picker.params.shortTime?"hh":"HH")}}:{{picker.currentNearestMinute().format("mm")}}:{{picker.currentNearestMinute().format("ss")}}
{{::picker.params.todayText}} {{::picker.params.cancelText}} {{::picker.params.okText}} ';angular.module(e,["ngMaterial"]).factory("mdcDefaultParams",function(){var a={date:!0,time:!0,minutes:!0,seconds:!1,format:"YYYY-MM-DD",minDate:null,maxDate:null,currentDate:null,lang:window.navigator.userLanguage||window.navigator.language||"en",weekStart:0,shortTime:!1,cancelText:"Cancel",okText:"OK",amText:"AM",pmText:"PM",todayBtn:!0,todayText:"Today",disableDates:[],weekDays:!1,disableParentScroll:!1,autoOk:!1,editInput:!1,clickOutsideToClose:!1,minuteSteps:5,showIcon:!1,showClear:!0,template:f,templateUrl:"",targetEvent:null,openFrom:null,closeTo:null,dayOfWeekLen:1,hasBackdrop:!0};return function(e){if(e)for(var t in e)a.hasOwnProperty(t)&&e.hasOwnProperty(t)&&(a[t]=e[t]);return a}}).directive("mdcDatetimePicker",["$mdDialog","$timeout","$compile",function(u,m,p){return{restrict:"A",require:"ngModel",scope:{currentDate:"=ngModel",ngModelOptions:"=",ngChange:"&",time:"=",date:"=",minutes:"=",seconds:"=",minDate:"=",maxDate:"=",disableDates:"=",weekDays:"=",shortTime:"=",weekStart:"=",format:"@",cancelText:"@",okText:"@",lang:"@",amText:"@",pmText:"@",showTodaysDate:"@",todayBtn:"=",todayText:"@",disableParentScroll:"=",autoOk:"=",editInput:"=",clickOutsideToClose:"=",minuteSteps:"=",showIcon:"=",showClear:"=",templateUrl:"@",dayOfWeekLen:"=",hasBackdrop:"="},link:function(n,r,s,c){var o=!1;n.format||(n.date&&n.time&&n.seconds?n.format="YYYY-MM-DD HH:mm:ss":n.date&&n.time?n.format="YYYY-MM-DD HH:mm":n.date?n.format="YYYY-MM-DD":n.format="HH:mm");var d,l=null;if(void 0!==n.showTodaysDate&&"false"!==n.showTodaysDate&&(l=h()),angular.isString(n.currentDate)&&""!==n.currentDate&&(n.currentDate=h(n.currentDate,n.format)),c){var e={"*":"$inherit",debounce:500};1===angular.version.major&&5',i=void 0===n.showClear||n.showClear?'':"";r.after(p(a+i)(n)),n.openCalendarDiag=function(e){t(e)},n.clear=function(){c.$setViewValue(null),n.currentDate=null,c.$render(),m(function(){n.ngChange(),r[0].focus()},0,!1)}}}}}]).factory("mdcDateTimeDialog",["$mdDialog","$q",function(i,n){return{show:function(e){var t=n.defer();void 0!==e.showTodaysDate&&"false"!==e.showTodaysDate&&(e.showTodaysDate=h());var a={controller:D,controllerAs:"picker",locals:{options:e},parent:angular.element(document.body),bindToController:!0,clickOutsideToClose:e.clickOutsideToClose||!1,disableParentScroll:e.disableParentScroll||!1,skipHide:!0,multiple:!0,hasBackdrop:void 0===e.hasBackdrop||e.hasBackdrop,targetEvent:e.targetEvent,openFrom:e.openFrom,closeTo:e.closeTo};return e.templateUrl?a.templateUrl=e.templateUrl:a.template=f,i.show(a).then(function(e){t.resolve(e&&!e._isUTC?e.toDate():e)},function(){t.reject()}),t.promise}}}]);var D=function(e,t){this.currentView=a.DATE,this._dialog=e,this._attachedEvents=[],this.VIEWS=a,this.params=angular.copy(t()),this.meridien="AM",this.params=angular.extend(this.params,this.options),this.init()};return D.$inject=["$mdDialog","mdcDefaultParams"],D.prototype={init:function(){this.timeMode=this.params.time&&!this.params.date,this.dateMode=this.params.date,this.initDates(),this.start()},currentNearestMinute:function(){var e=this.params.minuteSteps;(e<1||59=parseInt(n.format("X"))}return i},isBeforeMaxDate:function(e,t,a){var i=!0;if(void 0!==this.maxDate&&null!==this.maxDate){var n=h(this.maxDate),r=h(e);t||a||(n.hour(0),n.minute(0),r.hour(0),r.minute(0)),n.second(0),r.second(0),n.millisecond(0),r.millisecond(0),a||(r.minute(0),n.minute(0)),i=parseInt(r.format("X"))<=parseInt(n.format("X"))}return i},isInDisableDates:function(e){var t=e.format("MMMM Do YYYY");return!(-1
'}}]).directive("mdcDatetimePickerCalendarMonth",["$compile",function(s){var r=function(e,t){var a=angular.element(e[0].querySelector("tbody")),n=t.cal,i=t.month,r=[];i.days.forEach(function(e,i){r.push(""),e.forEach(function(e,t){if(r.push(""),e)if(n.isInRange(e)){var a="month['days']["+i+"]["+t+"]";r.push(''),r.push(e.format("D")),r.push("")}else r.push(''),r.push(e.format("D")),r.push("");r.push("")}),r.push("")}),a.html(r.join("")),s(a)(t)};return{scope:{idx:"="},require:"^mdcDatetimePickerCalendar",restrict:"AE",template:'
{{month.name}}
{{cal.toDay(day)}}
',link:function(a,i,e,n){a.cal=n,a.month=n.getItemAtIndex(parseInt(a.idx)),r(i,a),a.$watch(function(){return a.idx},function(e,t){e!=t&&(a.month=n.getItemAtIndex(parseInt(a.idx)),r(i,a))})}}}]),angular.module(e).directive("mdcDtpNoclick",function(){return{link:function(e,t){t.on("click",function(e){e.preventDefault()})}}}),angular.module(e).directive("mdcDatetimePickerClock",["$timeout",function(o){return{restrict:"E",template:'',link:function(S,V,O){var E="minutes"===O.mode,N="seconds"===O.mode,Y=S.picker,P=document.querySelector("md-dialog.dtp"),c="ontouchstart"in window,e={POINTER_DOWN:c?"touchstart":"mousedown",POINTER_UP:c?"touchend":"mouseup",POINTER_MOVE:c?"touchmove":"mousemove"},t=function(e){e.preventDefault();var t=e.currentTarget.closest("div"),a=t.getClientRects()[0];c&&(e=e.changedTouches[0]);var i=t.offsetWidth/2-(e.pageX-a.left),n=e.pageY-a.top-t.offsetHeight/2,r=Math.sqrt(Math.pow(i,2)+Math.pow(n,2)),s=Math.round(Math.atan2(i,n)*(180/Math.PI));o(function(){!function(e,t){var a=0;if(0!==(e=360<=e?0:e)){var i=E||N?60:12;a=Math.round(i/360*e)}if(E){var n=Y.params.minuteSteps;(n<1||59' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
{{picker.currentNearestMinute().format(\"dddd\")}}
' +\r\n '
{{picker.params.shortTime?picker.currentDate.format(\"A\"):\" \"}}
' +\r\n '
' +\r\n ' ×' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n '
{{picker.currentDate.format(\"MMM\")|uppercase}}
' +\r\n ' ' +\r\n ' ' +\r\n ' {{itemMonth}}' +\r\n ' ' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
{{picker.currentDate.format(\"DD\")}}
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n '
{{picker.currentDate.format(\"YYYY\")}}
' +\r\n ' ' +\r\n ' ' +\r\n ' {{itemYear}}' +\r\n ' ' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
'+\r\n '
' + //start time\r\n '
' +\r\n '
' +\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime ? \"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}'+\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime ? \"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}:{{picker.currentNearestMinute().format(\"ss\")}}'+\r\n ' {{picker.currentDate.format(\"A\")}}'+\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' {{::picker.params.amText}}' +\r\n '
' +\r\n '
' +\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime?\"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}' +\r\n '
' +\r\n '
' +\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime?\"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}:{{picker.currentNearestMinute().format(\"ss\")}}' +\r\n '
' +\r\n '
' +\r\n ' {{::picker.params.pmText}}' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n ' {{::picker.params.todayText}}' +\r\n ' {{::picker.params.cancelText}}' +\r\n ' {{::picker.params.okText}}' +\r\n ' ' +\r\n '';\r\n\r\n angular.module(moduleName, ['ngMaterial'])\r\n .factory('mdcDefaultParams', function () {\r\n var default_params = {\r\n date: true,\r\n time: true,\r\n minutes: true,\r\n seconds: false,\r\n format: 'YYYY-MM-DD',\r\n minDate: null,\r\n maxDate: null,\r\n currentDate: null,\r\n lang: window.navigator.userLanguage || window.navigator.language || 'en',\r\n weekStart: 0,\r\n shortTime: false,\r\n cancelText: 'Cancel',\r\n okText: 'OK',\r\n amText: 'AM',\r\n pmText: 'PM',\r\n todayBtn: true,\r\n todayText: 'Today',\r\n disableDates: [],\r\n weekDays: false,\r\n disableParentScroll: false,\r\n autoOk: false,\r\n editInput: false,\r\n clickOutsideToClose: false,\r\n minuteSteps: 5,\r\n showIcon: false,\r\n template: template,\r\n templateUrl: '',\r\n targetEvent: null,\r\n openFrom: null,\r\n closeTo: null,\r\n dayOfWeekLen: 1,\r\n hasBackdrop: true,\r\n };\r\n\r\n return function (params) {\r\n if (params) {\r\n for (var i in params) {\r\n if (default_params.hasOwnProperty(i) && params.hasOwnProperty(i)) default_params[i] = params[i];\r\n }\r\n }\r\n return default_params;\r\n };\r\n })\r\n .directive('mdcDatetimePicker', ['$mdDialog', '$timeout', '$compile',\r\n function ($mdDialog, $timeout, $compile) {\r\n return {\r\n restrict: 'A',\r\n require: 'ngModel',\r\n scope: {\r\n currentDate: '=ngModel',\r\n ngModelOptions: '=',\r\n ngChange: '&',\r\n time: '=',\r\n date: '=',\r\n minutes: '=',\r\n seconds: '=',\r\n minDate: '=',\r\n maxDate: '=',\r\n disableDates: '=',\r\n weekDays: '=',\r\n shortTime: '=',\r\n weekStart: '=',\r\n format: '@',\r\n cancelText: '@',\r\n okText: '@',\r\n lang: '@',\r\n amText: '@',\r\n pmText: '@',\r\n showTodaysDate: '@',\r\n todayBtn: '=',\r\n todayText: '@',\r\n disableParentScroll: '=',\r\n autoOk: '=',\r\n editInput: '=',\r\n clickOutsideToClose: '=',\r\n minuteSteps: '=',\r\n showIcon: '=',\r\n templateUrl: '@',\r\n dayOfWeekLen: '=',\r\n hasBackdrop: '='\r\n },\r\n link: function (scope, element, attrs, ngModel) {\r\n var isOn = false;\r\n if (!scope.format) {\r\n if (scope.date && scope.time && scope.seconds) scope.format = 'YYYY-MM-DD HH:mm:ss';\r\n else if (scope.date && scope.time) scope.format = 'YYYY-MM-DD HH:mm';\r\n else if (scope.date) scope.format = 'YYYY-MM-DD';\r\n else scope.format = 'HH:mm';\r\n }\r\n\r\n var dateOfTheDay = null;\r\n if (scope.showTodaysDate !== undefined && scope.showTodaysDate !== \"false\") {\r\n dateOfTheDay = moment();\r\n }\r\n\r\n if (angular.isString(scope.currentDate) && scope.currentDate !== '') {\r\n scope.currentDate = moment(scope.currentDate, scope.format);\r\n }\r\n\r\n var offset;\r\n if (ngModel) {\r\n var ngModelOptions = {'*': '$inherit', debounce: 500};\r\n if (angular.version.major === 1 && angular.version.minor > 5) {\r\n ngModel.$options = ngModel.$options.createChild(ngModelOptions);\r\n if (ngModel.$options.getOption('timezone')) offset = ngModel.$options.getOption('timezone');\r\n } else {\r\n if (scope.ngModelOptions && scope.ngModelOptions.timezone) ngModelOptions.timezone = scope.ngModelOptions.timezone;\r\n ngModel.$options = ngModelOptions;\r\n if (ngModel.$options.timezone) offset = ngModel.$options.timezone;\r\n }\r\n if (offset==='utc' || offset==='UTC') offset = 0;\r\n \r\n ngModel.$formatters.push(function (value) {\r\n if (typeof value === 'undefined') return;\r\n var m = moment(value);\r\n return m.isValid() ? m.format(scope.format) : '';\r\n });\r\n \r\n ngModel.$parsers.push(function (value) {\r\n if (typeof value === 'undefined') return;\r\n \r\n var m = moment(value, scope.format);\r\n if (offset !== undefined) m.utcOffset(offset, m._tzm === undefined);\r\n if (scope.minDate) ngModel.$setValidity('min', !m.isBefore(scope.minDate));\r\n if (scope.maxDate) ngModel.$setValidity('max', !m.isAfter(scope.maxDate));\r\n ngModel.$setValidity('format', moment(value, scope.format, true).isValid());\r\n\r\n return m.isValid() ? (m._isUTC ? m : m.toDate()) : '';\r\n });\r\n \r\n }\r\n\r\n function openCalendar(e) {\r\n e.preventDefault();\r\n element.blur();\r\n element.parent().removeClass('md-input-focused');\r\n if (isOn) {\r\n return;\r\n }\r\n isOn = true;\r\n var options = {};\r\n for (var i in attrs) {\r\n if (scope.hasOwnProperty(i) && !angular.isUndefined(scope[i])) {\r\n options[i] = scope[i];\r\n }\r\n }\r\n options.currentDate = scope.currentDate;\r\n options.showTodaysDate = dateOfTheDay;\r\n\r\n var dialogOptions = {\r\n controller: PluginController,\r\n controllerAs: 'picker',\r\n locals: {options: options},\r\n openFrom: element,\r\n closeTo: element,\r\n parent: angular.element(document.body),\r\n bindToController: true,\r\n clickOutsideToClose: options.clickOutsideToClose || false,\r\n disableParentScroll: options.disableParentScroll || false,\r\n hasBackdrop: options.hasBackdrop === undefined ? true : options.hasBackdrop,\r\n skipHide: true,\r\n multiple: true,\r\n };\r\n\r\n if (!options.templateUrl) dialogOptions.template = template;\r\n else dialogOptions.templateUrl = options.templateUrl;\r\n \r\n $mdDialog.show(dialogOptions).then(function(v) {\r\n\r\n if (offset !== undefined) v.utcOffset(offset, true);\r\n\r\n scope.currentDate = v && !v._isUTC ? v.toDate() : v;\r\n ngModel.$setValidity('format', true);\r\n ngModel.$setViewValue(scope.currentDate);\r\n ngModel.$setDirty();\r\n isOn = false;\r\n\r\n if (!moment(scope.currentDate).isSame(options.currentDate)) {\r\n $timeout(scope.ngChange, 0);\r\n }\r\n\r\n element.parent().removeClass('md-input-focused');\r\n }, function () {\r\n isOn = false;\r\n element.parent().removeClass('md-input-focused');\r\n });\r\n }\r\n\r\n if (!scope.editInput) {\r\n if (scope.showIcon) {\r\n element.on('click', openCalendar);\r\n } else {\r\n element.on('focus', openCalendar);\r\n }\r\n }\r\n \r\n if (scope.showIcon) {\r\n element.addClass('dtp-no-msclear dtp-input');\r\n var calendarButton =\r\n '' +\r\n '' +\r\n '',\r\n clearButton = '';\r\n element.after($compile(calendarButton + clearButton)(scope));\r\n\r\n scope.openCalendarDiag = function(e) {\r\n openCalendar(e);\r\n };\r\n\r\n scope.clear = function() {\r\n ngModel.$setViewValue(null);\r\n scope.currentDate = null;\r\n ngModel.$render();\r\n $timeout(function() {\r\n scope.ngChange();\r\n element[0].focus();\r\n }, 0, false);\r\n };\r\n }\r\n }\r\n };\r\n }])\r\n // Returns a service that opens a dialog when the attribute shown is called\r\n .factory('mdcDateTimeDialog', [\"$mdDialog\", \"$q\", function ($mdDialog, $q) {\r\n var service = {\r\n show: function (options) {\r\n var deferred = $q.defer();\r\n\r\n if (options.showTodaysDate !== undefined && options.showTodaysDate !== \"false\") options.showTodaysDate = moment();\r\n\r\n var dialogOptions = {\r\n controller: PluginController,\r\n controllerAs: 'picker',\r\n locals: {options: options},\r\n parent: angular.element(document.body),\r\n bindToController: true,\r\n clickOutsideToClose: options.clickOutsideToClose || false,\r\n disableParentScroll: options.disableParentScroll || false,\r\n skipHide: true,\r\n multiple: true,\r\n hasBackdrop: options.hasBackdrop === undefined ? true : options.hasBackdrop,\r\n targetEvent: options.targetEvent,\r\n openFrom: options.openFrom,\r\n closeTo: options.closeTo,\r\n };\r\n\r\n if (!options.templateUrl) dialogOptions.template = template;\r\n else dialogOptions.templateUrl = options.templateUrl;\r\n\r\n $mdDialog.show(dialogOptions).then(function (v) {\r\n deferred.resolve(v && !v._isUTC ? v.toDate() : v);\r\n }, function () {\r\n deferred.reject();\r\n });\r\n return deferred.promise;\r\n }\r\n };\r\n\r\n return service;\r\n }])\r\n ;\r\n\r\n var PluginController = function ($mdDialog, mdcDefaultParams) {\r\n this.currentView = VIEW_STATES.DATE;\r\n this._dialog = $mdDialog;\r\n\r\n this._attachedEvents = [];\r\n this.VIEWS = VIEW_STATES;\r\n this.params = angular.copy(mdcDefaultParams());\r\n this.meridien = 'AM';\r\n this.params = angular.extend(this.params, this.options);\r\n\r\n this.init();\r\n };\r\n\r\n PluginController.$inject = ['$mdDialog', 'mdcDefaultParams'];\r\n PluginController.prototype = {\r\n init: function () {\r\n this.timeMode = this.params.time && !this.params.date;\r\n this.dateMode = this.params.date;\r\n this.initDates();\r\n this.start();\r\n },\r\n currentNearestMinute: function () {\r\n var nearestMin = this.params.minuteSteps;\r\n if (nearestMin < 1 || nearestMin > 59) nearestMin = 1;\r\n\r\n var date = this.currentDate || moment();\r\n var minutes = (nearestMin * Math.round(date.minute() / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n\r\n var seconds;\r\n if (this.params.seconds) {\r\n seconds = date.second();\r\n if (seconds >= 60) seconds = 60 - 1;\r\n } else seconds = 0;\r\n\r\n return moment(date).minutes(minutes).seconds(seconds).millisecond(0);\r\n },\r\n initDates: function () {\r\n var that = this;\r\n var _dateParam = function (input, fallback) {\r\n var ret = null;\r\n if (angular.isDefined(input) && input !== null && input !== '') {\r\n if (angular.isString(input)) {\r\n if (typeof(that.params.format) !== 'undefined' && that.params.format !== null) {\r\n ret = moment(input, that.params.format).locale(that.params.lang);\r\n }\r\n else {\r\n ret = moment(input).locale(that.params.lang);\r\n }\r\n } else if (typeof input === 'number') {\r\n ret = moment(input).locale(that.params.lang);\r\n } else {\r\n if (angular.isDate(input)) {\r\n var x = input.getTime();\r\n ret = moment(x, \"x\").locale(that.params.lang);\r\n } else if (moment.isMoment(input)) {\r\n if (input.isValid()) ret = input;\r\n else ret = fallback;\r\n }\r\n }\r\n } else {\r\n ret = fallback;\r\n }\r\n return ret;\r\n };\r\n\r\n this.currentDate = _dateParam(this.params.currentDate, moment());\r\n this.currentDate = this.currentNearestMinute();\r\n this.minDate = _dateParam(this.params.minDate);\r\n this.maxDate = _dateParam(this.params.maxDate);\r\n this.disableDates = this.params.disableDates.map(function (x) {\r\n return moment(x).format('MMMM Do YYYY');\r\n });\r\n this.selectDate(this.currentDate);\r\n this.weekDays = this.params.weekDays;\r\n },\r\n initDate: function () {\r\n this.currentView = VIEW_STATES.DATE;\r\n },\r\n initHours: function () {\r\n this.currentView = VIEW_STATES.HOUR;\r\n },\r\n initMinutes: function () {\r\n this.currentView = VIEW_STATES.MINUTE;\r\n },\r\n initSeconds: function () {\r\n this.currentView = VIEW_STATES.SECOND;\r\n },\r\n isAfterMinDate: function (date, checkHour, checkMinute) {\r\n var _return = true;\r\n\r\n if (typeof(this.minDate) !== 'undefined' && this.minDate !== null) {\r\n var _minDate = moment(this.minDate);\r\n var _date = moment(date);\r\n\r\n if (!checkHour && !checkMinute) {\r\n _minDate.hour(0);\r\n _minDate.minute(0);\r\n\r\n _date.hour(0);\r\n _date.minute(0);\r\n }\r\n\r\n _minDate.second(0);\r\n _date.second(0);\r\n _minDate.millisecond(0);\r\n _date.millisecond(0);\r\n\r\n if (!checkMinute) {\r\n _date.minute(0);\r\n _minDate.minute(0);\r\n\r\n _return = (parseInt(_date.format(\"X\")) >= parseInt(_minDate.format(\"X\")));\r\n }\r\n else {\r\n _return = (parseInt(_date.format(\"X\")) >= parseInt(_minDate.format(\"X\")));\r\n }\r\n }\r\n\r\n return _return;\r\n },\r\n isBeforeMaxDate: function (date, checkTime, checkMinute) {\r\n var _return = true;\r\n\r\n if (typeof(this.maxDate) !== 'undefined' && this.maxDate !== null) {\r\n var _maxDate = moment(this.maxDate);\r\n var _date = moment(date);\r\n\r\n if (!checkTime && !checkMinute) {\r\n _maxDate.hour(0);\r\n _maxDate.minute(0);\r\n\r\n _date.hour(0);\r\n _date.minute(0);\r\n }\r\n\r\n _maxDate.second(0);\r\n _date.second(0);\r\n _maxDate.millisecond(0);\r\n _date.millisecond(0);\r\n\r\n if (!checkMinute) {\r\n _date.minute(0);\r\n _maxDate.minute(0);\r\n\r\n _return = (parseInt(_date.format(\"X\")) <= parseInt(_maxDate.format(\"X\")));\r\n }\r\n else {\r\n _return = (parseInt(_date.format(\"X\")) <= parseInt(_maxDate.format(\"X\")));\r\n }\r\n }\r\n\r\n return _return;\r\n },\r\n isInDisableDates: function (date) {\r\n var dut = date.format('MMMM Do YYYY');\r\n if (this.disableDates.indexOf(dut) > -1) {\r\n return false;\r\n }\r\n return true;\r\n },\r\n isWeekDay: function(date) {\r\n if (this.weekDays) {\r\n if (date.isoWeekday() <= 5) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n return true;\r\n },\r\n selectDate: function (date) {\r\n if (date) {\r\n this.currentDate = moment(date);\r\n if (!this.isAfterMinDate(this.currentDate, true, true)) {\r\n this.currentDate = moment(this.minDate);\r\n }\r\n\r\n if (!this.isBeforeMaxDate(this.currentDate, true, true)) {\r\n this.currentDate = moment(this.maxDate);\r\n }\r\n this.currentDate.locale(this.params.lang);\r\n this.calendarStart = moment(this.currentDate);\r\n this.meridien = this.currentDate.hour() >= 12 ? 'PM' : 'AM';\r\n }\r\n },\r\n isPM: function () {\r\n return this.meridien === 'PM';\r\n },\r\n incrementMonth: function (amount) {\r\n if (amount === 1 && this.isNextMonthVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'month'));\r\n }\r\n\r\n if (amount === -1 && this.isPreviousMonthVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'month'));\r\n }\r\n },\r\n incrementYear: function (amount) {\r\n if (amount === 1 && this.isNextYearVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'year'));\r\n }\r\n\r\n if (amount === -1 && this.isPreviousYearVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'year'));\r\n }\r\n },\r\n openMenu: function ($mdMenu, ev) {\r\n $mdMenu.open(ev); \r\n },\r\n monthsAvailable: function () {\r\n var monthsArr = [], \r\n _date = moment(this.currentDate);\r\n\r\n for (var m = 0; m < 12; m++) {\r\n var curMonth = _date.month(m);\r\n if (this.isAfterMinDate(curMonth.endOf('month')) && this.isBeforeMaxDate(curMonth.startOf('month'))) {\r\n monthsArr.push(curMonth.format('MMMM'));\r\n }\r\n }\r\n return monthsArr;\r\n },\r\n selectMonth: function (month) {\r\n this.selectDate(this.currentDate.month(month));\r\n },\r\n yearsAvailable: function () {\r\n var _minDate, _maxDate, len, startYear, yearsArr = [],\r\n _date = this.currentDate.year();\r\n\r\n if (typeof(this.minDate) !== 'undefined' && this.minDate !== null) {\r\n _minDate = moment(this.minDate).year();\r\n }\r\n if (typeof(this.maxDate) !== 'undefined' && this.maxDate !== null) {\r\n _maxDate = moment(this.maxDate).year();\r\n }\r\n\r\n if (_maxDate && _minDate) {\r\n len = _maxDate - _minDate;\r\n startYear = _minDate;\r\n } else if (_minDate) {\r\n len = 115;\r\n startYear = _minDate;\r\n } else if (_maxDate) {\r\n len = 30;\r\n startYear = _maxDate - len;\r\n } else {\r\n len = 60;\r\n startYear = _date - len/2;\r\n }\r\n \r\n for (var i=0; i <= len; i++) {\r\n yearsArr.push(startYear+i);\r\n }\r\n return yearsArr;\r\n },\r\n selectYear: function (year) {\r\n this.selectDate(this.currentDate.year(year));\r\n },\r\n isPreviousMonthVisible: function () {\r\n return this.calendarStart && this.isAfterMinDate(moment(this.calendarStart).startOf('month'), false, false);\r\n },\r\n isNextMonthVisible: function () {\r\n return this.calendarStart && this.isBeforeMaxDate(moment(this.calendarStart).endOf('month'), false, false);\r\n },\r\n isPreviousYearVisible: function () {\r\n return this.calendarStart && this.isAfterMinDate(moment(this.calendarStart).startOf('year'), false, false);\r\n },\r\n isNextYearVisible: function () {\r\n return this.calendarStart && this.isBeforeMaxDate(moment(this.calendarStart).endOf('year'), false, false);\r\n },\r\n isHourAvailable: function (hour) {\r\n var _date = moment(this.currentDate);\r\n if (this.params.shortTime) {\r\n _date.hour(this.convertHours(hour)).minute(0).second(0);\r\n } else {\r\n _date.hour(hour).minute(0).second(0);\r\n }\r\n return this.isAfterMinDate(_date, true, false) && this.isBeforeMaxDate(_date, true, false);\r\n },\r\n isMinuteAvailable: function (minute) {\r\n var _date = moment(this.currentDate);\r\n _date.minute(minute).second(0);\r\n\r\n var nearestMin = this.params.minuteSteps;\r\n if (nearestMin > 1 && 5 % nearestMin !== 0){\r\n var _curmin = _date.minute();\r\n var minutes = (nearestMin * Math.round(_curmin / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n if (minutes !== _curmin) return false;\r\n }\r\n\r\n return this.isAfterMinDate(_date, true, true) && this.isBeforeMaxDate(_date, true, true);\r\n },\r\n isSecondAvailable: function (second) {\r\n return true;\r\n },\r\n start: function () {\r\n this.currentView = VIEW_STATES.DATE;\r\n if (this.params.date) {\r\n this.initDate();\r\n } else {\r\n if (this.params.time) {\r\n this.initHours();\r\n }\r\n }\r\n },\r\n today: function () {\r\n var nearestMin = this.params.minuteSteps;\r\n var date = moment();\r\n var minutes = (nearestMin * Math.round(date.minute() / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n\r\n var seconds;\r\n if (this.params.seconds) {\r\n seconds = date.second();\r\n if (seconds >= 60) seconds = 60 - 1;\r\n } else seconds = 0;\r\n\r\n this.selectDate(moment(date).minutes(minutes).seconds(seconds).millisecond(0));\r\n },\r\n ok: function () {\r\n switch (this.currentView) {\r\n case VIEW_STATES.DATE:\r\n if (this.params.time === true) {\r\n this.initHours();\r\n } else {\r\n this.hide(true);\r\n }\r\n break;\r\n case VIEW_STATES.HOUR:\r\n if (this.params.minutes === true) {\r\n this.initMinutes();\r\n } else {\r\n this.hide(true);\r\n }\r\n break;\r\n case VIEW_STATES.MINUTE:\r\n if (this.params.seconds === true) {\r\n this.initSeconds();\r\n } else {\r\n this.hide(true);\r\n }\r\n break;\r\n case VIEW_STATES.SECOND:\r\n this.hide(true);\r\n break;\r\n }\r\n },\r\n cancel: function () {\r\n if (this.params.time) {\r\n switch (this.currentView) {\r\n case VIEW_STATES.DATE:\r\n this.hide();\r\n break;\r\n case VIEW_STATES.HOUR:\r\n if (this.params.date) {\r\n this.initDate();\r\n }\r\n else {\r\n this.hide();\r\n }\r\n break;\r\n case VIEW_STATES.MINUTE:\r\n this.initHours();\r\n break;\r\n case VIEW_STATES.SECOND:\r\n this.initMinutes();\r\n break;\r\n }\r\n }\r\n else {\r\n this.hide();\r\n }\r\n },\r\n selectMonthBefore: function () {\r\n this.calendarStart.subtract(1, 'months');\r\n },\r\n selectMonthAfter: function () {\r\n this.calendarStart.add(1, 'months');\r\n },\r\n selectYearBefore: function () {\r\n this.calendarStart.subtract(1, 'years');\r\n },\r\n selectYearAfter: function () {\r\n this.calendarStart.add(1, 'years');\r\n },\r\n selectAM: function () {\r\n if (this.isHourAvailable(0) || this.isHourAvailable(12)) {\r\n if (this.currentDate.hour() >= 12) {\r\n this.selectDate(this.currentDate.subtract(12, 'hours'));\r\n }\r\n if (!this.isHourAvailable(this.currentDate.hour())) {\r\n this.selectDate(this.currentDate.hour(this.minDate.hour()));\r\n }\r\n if (!this.isMinuteAvailable(this.currentDate.minute())) {\r\n this.selectDate(this.currentDate.minute(this.minDate.minute()));\r\n }\r\n }\r\n },\r\n selectPM: function () {\r\n if (this.isHourAvailable(12) || this.isHourAvailable(24)) {\r\n if (this.currentDate.hour() < 12) {\r\n this.selectDate(this.currentDate.add(12, 'hours'));\r\n }\r\n if (!this.isHourAvailable(this.currentDate.hour())) {\r\n this.selectDate(this.currentDate.hour(this.maxDate.hour()));\r\n }\r\n if (!this.isMinuteAvailable(this.currentDate.minute())) {\r\n this.selectDate(this.currentDate.minute(this.maxDate.minute()));\r\n }\r\n }\r\n },\r\n convertHours: function (h) {\r\n var _return = h;\r\n if (h < 12 && this.isPM()) _return += 12;\r\n\r\n return _return;\r\n },\r\n hide: function (okBtn) {\r\n if (okBtn) this._dialog.hide(this.currentDate);\r\n else this._dialog.cancel();\r\n }\r\n };\r\n\r\n angular.module(moduleName)\r\n .directive('mdcDatetimePickerCalendar', [\r\n function () {\r\n\r\n var YEAR_MIN = 1920,\r\n YEAR_MAX = new Date().getFullYear() + 30,\r\n MONTHS_IN_ALL = (YEAR_MAX - YEAR_MIN + 1) * 12,\r\n ITEM_HEIGHT = 240,\r\n MONTHS = [];\r\n for (var i = 0; i < MONTHS_IN_ALL; i++) {\r\n MONTHS.push(i);\r\n }\r\n\r\n var currentMonthIndex = function (date, low) {\r\n low = low ? low : 0;\r\n var year = date.year();\r\n var month = date.month();\r\n return (((year - YEAR_MIN) * 12) + month - 1) - low;\r\n };\r\n\r\n return {\r\n restrict: 'E',\r\n scope: {\r\n picker: '=',\r\n date: '='\r\n },\r\n bindToController: true,\r\n controllerAs: 'cal',\r\n controller: ['$scope', function ($scope) {\r\n var calendar = this, picker;\r\n\r\n this.$onInit = function () {\r\n picker = this.picker;\r\n\r\n var days = [];\r\n for (var i = picker.params.weekStart; days.length < 7; i++) {\r\n if (i > 6) i = 0;\r\n days.push(i.toString());\r\n }\r\n calendar.week = days;\r\n\r\n if (!picker.maxDate && !picker.minDate) {\r\n calendar.months = MONTHS;\r\n } else {\r\n var low = picker.minDate ? currentMonthIndex(picker.minDate) : 0;\r\n var high = picker.maxDate ? (currentMonthIndex(picker.maxDate) + 1) : MONTHS_IN_ALL;\r\n calendar.months = MONTHS.slice(low, high);\r\n }\r\n\r\n calendar.topIndex = currentMonthIndex(picker.currentDate) - calendar.months[0];\r\n };\r\n\r\n if (angular.version.major === 1 && angular.version.minor < 5) this.$onInit();\r\n \r\n calendar.getItemAtIndex = function (index) {\r\n var month = ((index + 1) % 12) || 12;\r\n var year = YEAR_MIN + Math.floor(index / 12);\r\n var monthObj = moment(picker.currentDate).year(year).month(month);\r\n return generateMonthCalendar(monthObj);\r\n };\r\n\r\n $scope.$watch(function () {\r\n return picker.currentDate ? picker.currentDate.format('YYYY-MM') : '';\r\n }, function (val2, val1) {\r\n if (val2 != val1) {\r\n var nDate = moment(val2, 'YYYY-MM');\r\n var low = picker.minDate ? currentMonthIndex(picker.minDate) : 0;\r\n var index = currentMonthIndex(nDate, low);\r\n if (calendar.topIndex != index) {\r\n calendar.topIndex = index;\r\n }\r\n }\r\n });\r\n\r\n var generateMonthCalendar = function (date) {\r\n var month = {};\r\n if (date !== null) {\r\n month.name = date.format('MMMM YYYY');\r\n var startOfMonth = moment(date).locale(picker.params.lang).startOf('month')\r\n .hour(date.hour())\r\n .minute(date.minute());\r\n var iNumDay = startOfMonth.format('d');\r\n month.days = [];\r\n for (var i = startOfMonth.date(); i <= startOfMonth.daysInMonth(); i++) {\r\n if (i === startOfMonth.date()) {\r\n var iWeek = calendar.week.indexOf(iNumDay.toString());\r\n if (iWeek > 0) {\r\n for (var x = 0; x < iWeek; x++) {\r\n month.days.push(0);\r\n }\r\n }\r\n }\r\n month.days.push(moment(startOfMonth).locale(picker.params.lang).date(i));\r\n }\r\n\r\n var daysInAWeek = 7, daysTmp = [], slices = Math.ceil(month.days.length / daysInAWeek);\r\n for (var j = 0; j < slices; j++) {\r\n daysTmp.push(month.days.slice(j * daysInAWeek, (j + 1) * daysInAWeek));\r\n }\r\n month.days = daysTmp;\r\n return month;\r\n }\r\n\r\n };\r\n\r\n calendar.toDay = function (i) {\r\n return moment(parseInt(i), \"d\")\r\n .locale(picker.params.lang)\r\n .format(\"ddd\")\r\n .substring(0, picker.params.dayOfWeekLen);\r\n };\r\n\r\n calendar.isInRange = function (date) {\r\n return picker.isAfterMinDate(moment(date), false, false) &&\r\n picker.isBeforeMaxDate(moment(date), false, false) &&\r\n picker.isWeekDay(moment(date)) &&\r\n picker.isInDisableDates(moment(date));\r\n };\r\n\r\n calendar.selectDate = function (date) {\r\n if (date) {\r\n if (calendar.isSelectedDay(date)) {\r\n return picker.ok();\r\n }\r\n picker.selectDate(moment(date).hour(calendar.date.hour()).minute(calendar.date.minute()));\r\n if (picker.params.autoOk) {\r\n picker.ok();\r\n }\r\n }\r\n };\r\n\r\n calendar.isSelectedDay = function (m) {\r\n return m && calendar.date.date() === m.date() && calendar.date.month() === m.month() && calendar.date.year() === m.year();\r\n };\r\n\r\n calendar.isDateOfTheDay = function (m) {\r\n var today = calendar.picker.options.showTodaysDate;\r\n if (!today) {\r\n return false;\r\n }\r\n\r\n return m && today.date() === m.date() && today.month() === m.month() && today.year() === m.year();\r\n };\r\n }],\r\n template: \r\n '' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
'\r\n };\r\n }])\r\n .directive('mdcDatetimePickerCalendarMonth', ['$compile',\r\n function ($compile) {\r\n var buildCalendarContent = function (element, scope) {\r\n var tbody = angular.element(element[0].querySelector('tbody'));\r\n var calendar = scope.cal, month = scope.month;\r\n\r\n var tbodyHtml = [];\r\n\r\n month.days.forEach(function (weekDays, i) {\r\n tbodyHtml.push('');\r\n weekDays.forEach(function (weekDay, j) {\r\n tbodyHtml.push('');\r\n if (weekDay) {\r\n if (calendar.isInRange(weekDay)) {\r\n //build a\r\n var scopeRef = 'month[\\'days\\'][' + i + '][' + j + ']';\r\n\r\n tbodyHtml.push('');\r\n tbodyHtml.push(weekDay.format('D'));\r\n tbodyHtml.push('');\r\n } else {\r\n tbodyHtml.push('');\r\n tbodyHtml.push(weekDay.format('D'));\r\n tbodyHtml.push('');\r\n }\r\n }\r\n tbodyHtml.push('');\r\n });\r\n tbodyHtml.push('');\r\n });\r\n\r\n tbody.html(tbodyHtml.join(''));\r\n $compile(tbody)(scope);\r\n };\r\n\r\n return {\r\n scope: {\r\n idx: '='\r\n },\r\n require: '^mdcDatetimePickerCalendar',\r\n restrict: 'AE',\r\n template: \r\n '
{{month.name}}
' +\r\n '' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n '
{{cal.toDay(day)}}
',\r\n link: function (scope, element, attrs, calendar) {\r\n scope.cal = calendar;\r\n scope.month = calendar.getItemAtIndex(parseInt(scope.idx));\r\n buildCalendarContent(element, scope);\r\n scope.$watch(function () {\r\n return scope.idx;\r\n }, function (idx, oldIdx) {\r\n if (idx != oldIdx) {\r\n scope.month = calendar.getItemAtIndex(parseInt(scope.idx));\r\n buildCalendarContent(element, scope);\r\n }\r\n });\r\n }\r\n };\r\n }\r\n ])\r\n ;\r\n\r\n angular.module(moduleName)\r\n .directive('mdcDtpNoclick', function () {\r\n return {\r\n link: function (scope, el) {\r\n el.on('click', function (e) {\r\n e.preventDefault();\r\n });\r\n }\r\n };\r\n });\r\n angular.module(moduleName)\r\n .directive('mdcDatetimePickerClock', ['$timeout',\r\n function ($timeout) {\r\n\r\n var template = \r\n '
 ' +\r\n '
' +\r\n ' {{point.display}}' +\r\n ' {{point.display}}' +\r\n '
' +\r\n '
' +\r\n ' {{point24.display}}' +\r\n ' {{point24.display}}' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
';\r\n\r\n return {\r\n restrict: 'E',\r\n template: template,\r\n link: function (scope, element, attrs) {\r\n var minuteMode = attrs.mode === 'minutes';\r\n var secondMode = attrs.mode === 'seconds';\r\n var picker = scope.picker;\r\n //banking on the fact that there will only be one at a time\r\n var componentRoot = document.querySelector('md-dialog.dtp');\r\n\r\n var setTimeDegRay = function(deg, ray) {\r\n var val = 0;\r\n deg = deg >= 360 ? 0 : deg;\r\n if (deg !== 0) {\r\n var divider = minuteMode||secondMode ? 60 : 12;\r\n val = Math.round(divider / 360 * deg);\r\n }\r\n\r\n if (minuteMode) {\r\n var nearestMin = picker.params.minuteSteps;\r\n if (nearestMin < 1 || nearestMin > 59) nearestMin = 1;\r\n var minutes = (nearestMin * Math.round(val / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n if (!scope.pointAvailable({value: val})) return;\r\n picker.currentDate.minute(minutes);\r\n } else if (!secondMode){\r\n if (val === 12) val = 0;\r\n if (!picker.params.shortTime) picker.meridien = ray > 84 ? 'AM' : 'PM';\r\n if (picker.isPM()) val += 12;\r\n if (!scope.pointAvailable({value: val})) return;\r\n picker.currentDate.hour(val);\r\n } else {\r\n if (val >= 60) val = 0;\r\n if (!scope.pointAvailable({value: val})) return;\r\n picker.currentDate.second(val);\r\n }\r\n };\r\n\r\n var isTouchSupported = ('ontouchstart' in window) ? true : false,\r\n EVENTS = {\r\n POINTER_DOWN : isTouchSupported ? 'touchstart' : 'mousedown',\r\n POINTER_UP : isTouchSupported ? 'touchend' : 'mouseup',\r\n POINTER_MOVE : isTouchSupported ? 'touchmove' : 'mousemove'\r\n };\r\n\r\n var onMoveEvent = function(e) {\r\n e.preventDefault();\r\n\r\n var closestTarget = e.currentTarget.closest('div'),\r\n clientRect = closestTarget.getClientRects()[0];\r\n\r\n if (isTouchSupported) e = e.changedTouches[0];\r\n \r\n var x = ((closestTarget.offsetWidth / 2) - (e.pageX - clientRect.left)),\r\n y = ((e.pageY - clientRect.top) - (closestTarget.offsetHeight / 2));\r\n\r\n var ray = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)),\r\n deg = Math.round((Math.atan2(x, y) * (180 / Math.PI)));\r\n\r\n $timeout(function() {\r\n setTimeDegRay(deg+180, ray);\r\n });\r\n };\r\n\r\n element.on(EVENTS.POINTER_DOWN, function() {\r\n element.on(EVENTS.POINTER_MOVE, onMoveEvent);\r\n });\r\n\r\n element.on(EVENTS.POINTER_UP, function() {\r\n element.off(EVENTS.POINTER_MOVE);\r\n });\r\n\r\n scope.$on(\"$destroy\", function() {\r\n element.off(EVENTS.POINTER_MOVE, onMoveEvent); \r\n });\r\n\r\n var exec = function () {\r\n var clock = angular.element(element[0].querySelector('.dtp-picker-clock')),\r\n pickerEl = angular.element(componentRoot.querySelector('.dtp-picker'));\r\n\r\n var w = componentRoot.querySelector('.dtp-content').offsetWidth;\r\n var pL = parseInt(css(pickerEl, 'paddingLeft').replace('px', '')) || 0;\r\n var pR = parseInt(css(pickerEl, 'paddingRight').replace('px', '')) || 0;\r\n var pT = parseInt(css(pickerEl, 'paddingTop').replace('px', '')) || 0;\r\n var mL = parseInt(css(clock, 'marginLeft').replace('px', '')) || 0;\r\n var mR = parseInt(css(clock, 'marginRight').replace('px', '')) || 0;\r\n var mT = parseInt(css(clock, 'marginTop').replace('px', '')) || 0;\r\n\r\n //set width\r\n var clockWidth = (w - (mL + mR + pL + pR));\r\n clock.css('width', (clockWidth) + 'px');\r\n\r\n var r = (clockWidth / 2);\r\n var j = r / 1.2; // radius for low number\r\n\r\n var points = [];\r\n\r\n for (var h = 0; h < 12; ++h) {\r\n var x = j * Math.sin(Math.PI * 2 * (h / 12));\r\n var y = j * Math.cos(Math.PI * 2 * (h / 12));\r\n var left = (r + x + pL / 2) - (pL + mL);\r\n var top = (r - y - mT / 2) - (pT + mT);\r\n\r\n var hour = {\r\n left: left,\r\n top: top,\r\n value: (minuteMode||secondMode ? (h * 5) : h), //5 for minute 60/12\r\n style: {'margin-left': left + 'px', 'margin-top': top + 'px'}\r\n };\r\n\r\n if (minuteMode || secondMode) {\r\n hour.display = hour.value < 10 ? ('0' + hour.value) : hour.value;\r\n } else {\r\n if (picker.params.shortTime) {\r\n hour.display = h === 0 ? 12 : h;\r\n } else {\r\n hour.display = h;\r\n }\r\n }\r\n\r\n points.push(hour);\r\n }\r\n scope.points = points;\r\n\r\n if (!picker.params.shortTime && !minuteMode && !secondMode) {\r\n var points24 = [];\r\n\r\n var j24 = r / 1.8; // radius for high number\r\n for (var h24 = 12; h24 < 24; ++h24) {\r\n var x24 = j24 * Math.sin(Math.PI * 2 * (h24 / 12));\r\n var y24 = j24 * Math.cos(Math.PI * 2 * (h24 / 12));\r\n var left24 = (r + x24 + pL / 2) - (pL + mL);\r\n var top24 = (r - y24 - mT / 2) - (pT + mT);\r\n\r\n points24.push({\r\n left: left24,\r\n top: top24,\r\n value: h24,\r\n display: h24,\r\n style: {'margin-left': left24 + 'px', 'margin-top': top24 + 'px'}\r\n });\r\n }\r\n scope.points24 = points24;\r\n }\r\n\r\n scope.mode = attrs.mode;\r\n setCurrentValue();\r\n clock.css('height', clockWidth + 'px');\r\n\r\n var clockCenter = element[0].querySelector('.dtp-clock-center');\r\n var centerWidth = (clockCenter.offsetWidth / 2) || 7.5;\r\n var centerHeight = (clockCenter.offsetHeight / 2) || 7.5;\r\n var _hL = r / (picker.params.shortTime ? 1.8 : 2.3);\r\n var _mL = r / 1.4;\r\n var _sL = r;\r\n\r\n angular.element(element[0].querySelector('.dtp-hour-hand')).css({\r\n left: r + (mL * 1.5) + 'px',\r\n height: _hL + 'px',\r\n marginTop: (r - _hL - pL) + 'px'\r\n }).addClass(!minuteMode && !secondMode ? 'on' : '');\r\n\r\n angular.element(element[0].querySelector('.dtp-minute-hand')).css({\r\n left: r + (mL * 1.5) + 'px',\r\n height: _mL + 'px',\r\n marginTop: r - _mL - pL + 'px'\r\n }).addClass(minuteMode ? 'on' : '');\r\n\r\n angular.element(element[0].querySelector('.dtp-second-hand')).css({\r\n left: r + (mL * 1.5) + 'px',\r\n height: _sL + 'px',\r\n marginTop: r - _sL - pL + 'px'\r\n }).addClass(secondMode ? 'on' : '');\r\n\r\n angular.element(clockCenter).css({\r\n left: r + pL + mL - centerWidth + 'px',\r\n marginTop: (r - (mL / 2)) - centerHeight + 'px'\r\n });\r\n animateHands();\r\n };\r\n\r\n var animateHands = function () {\r\n var _date = picker.currentNearestMinute();\r\n var h = _date.hour(), m = _date.minute(), s = _date.second();\r\n\r\n rotateElement(angular.element(element[0].querySelector('.dtp-hour-hand')), 30 * h);\r\n rotateElement(angular.element(element[0].querySelector('.dtp-minute-hand')), 6 * m);\r\n rotateElement(angular.element(element[0].querySelector('.dtp-second-hand')), 6 * s);\r\n };\r\n\r\n var rotateElement = function (el, deg) {\r\n angular.element(el).css({\r\n WebkitTransform: 'rotate(' + deg + 'deg)',\r\n '-moz-transform': 'rotate(' + deg + 'deg)',\r\n '-ms-transform': 'rotate(' + deg + 'deg)',\r\n 'transform': 'rotate(' + deg + 'deg)'\r\n });\r\n };\r\n\r\n\r\n var setCurrentValue = function () {\r\n var date = picker.currentNearestMinute();\r\n var nbH = picker.params.shortTime ? 12 : 24;\r\n if (minuteMode) scope.currentValue = date.minute();\r\n else if (secondMode) scope.currentValue = date.second();\r\n else scope.currentValue = date.hour() % nbH;\r\n };\r\n\r\n scope.$watch(function () {\r\n var tmp = picker.currentNearestMinute();\r\n return tmp ? tmp.format('HH:mm:ss') : '';\r\n }, function () {\r\n setCurrentValue();\r\n animateHands();\r\n });\r\n\r\n scope.setTime = function (val) {\r\n if (!minuteMode && !secondMode) {\r\n if (val === scope.currentValue && !picker.params.autoOk) picker.ok(); // double click\r\n\r\n if (picker.params.shortTime) {\r\n picker.currentDate.hour(picker.isPM() ? (val + 12) : val);\r\n } else {\r\n picker.currentDate.hour(val);\r\n if (val >= 12) picker.meridien = 'PM';\r\n else picker.meridien = 'AM';\r\n }\r\n\r\n if (picker.params.autoOk) picker.ok(); // single click\r\n } else if (!secondMode) {\r\n if (val === scope.currentValue && !picker.params.seconds) picker.ok(); // double click\r\n \r\n picker.currentDate.minute(val);\r\n if (!picker.params.seconds) {\r\n picker.currentDate.second(0);\r\n } else if (picker.params.autoOk) picker.ok(); // single click\r\n } else {\r\n if (val === scope.currentValue) picker.ok(); // double click\r\n picker.currentDate.second(val);\r\n }\r\n };\r\n\r\n scope.pointAvailable = function (point) {\r\n if (minuteMode) return picker.isMinuteAvailable(point.value);\r\n else if (secondMode) return picker.isSecondAvailable(point.value);\r\n else return picker.isHourAvailable(point.value);\r\n };\r\n\r\n var unWatcher = scope.$watch(function () {\r\n return element[0].querySelectorAll('div').length;\r\n }, function () {\r\n exec();\r\n unWatcher();\r\n });\r\n }\r\n };\r\n }]);\r\n return moduleName;\r\n }\r\n\r\n var isElectron = window && window.process && window.process.type;\r\n if (typeof define === 'function' && define.amd) {\r\n define(['moment'], ngMaterialDatePicker);\r\n } else if (typeof module !== 'undefined' && module && module.exports && (typeof require === 'function') && !isElectron) {\r\n module.exports = ngMaterialDatePicker(require('moment'));\r\n } else {\r\n ngMaterialDatePicker((typeof global !== 'undefined' ? global : window).moment);\r\n }\r\n})();\r\n"]} \ No newline at end of file +{"version":3,"sources":["angular-material-datetimepicker.js"],"names":["ngMaterialDatePicker","moment","moduleName","VIEW_STATES","DATE","HOUR","MINUTE","css","el","name","angular","element","window","getComputedStyle","template","module","factory","default_params","date","time","minutes","seconds","format","minDate","maxDate","currentDate","lang","navigator","userLanguage","language","weekStart","shortTime","cancelText","okText","amText","pmText","todayBtn","todayText","disableDates","weekDays","disableParentScroll","autoOk","editInput","clickOutsideToClose","minuteSteps","showIcon","showClear","templateUrl","targetEvent","openFrom","closeTo","dayOfWeekLen","hasBackdrop","params","i","hasOwnProperty","directive","$mdDialog","$timeout","$compile","restrict","require","scope","ngModelOptions","ngChange","showTodaysDate","link","attrs","ngModel","isOn","offset","dateOfTheDay","undefined","isString","*","debounce","version","major","minor","$options","createChild","getOption","timezone","$formatters","push","value","m","isValid","$parsers","utcOffset","_tzm","$setValidity","isBefore","isAfter","_isUTC","toDate","openCalendar","e","preventDefault","blur","parent","removeClass","options","isUndefined","dialogOptions","controller","PluginController","controllerAs","locals","document","body","bindToController","skipHide","multiple","show","then","v","$setViewValue","$setDirty","isSame","on","addClass","calendarButton","clearButton","after","openCalendarDiag","clear","$render","focus","$q","deferred","defer","resolve","reject","promise","mdcDefaultParams","this","currentView","_dialog","_attachedEvents","VIEWS","copy","meridien","extend","init","$inject","prototype","timeMode","dateMode","initDates","start","currentNearestMinute","nearestMin","Math","round","minute","second","millisecond","that","_dateParam","input","fallback","ret","isDefined","locale","isDate","x","getTime","isMoment","map","selectDate","initDate","initHours","initMinutes","initSeconds","SECOND","isAfterMinDate","checkHour","checkMinute","_return","_minDate","_date","hour","parseInt","isBeforeMaxDate","checkTime","_maxDate","isInDisableDates","dut","indexOf","isWeekDay","isoWeekday","calendarStart","isPM","incrementMonth","amount","isNextMonthVisible","add","isPreviousMonthVisible","incrementYear","isNextYearVisible","isPreviousYearVisible","openMenu","$mdMenu","ev","open","monthsAvailable","monthsArr","curMonth","month","endOf","startOf","selectMonth","yearsAvailable","len","startYear","yearsArr","year","selectYear","isHourAvailable","convertHours","isMinuteAvailable","_curmin","isSecondAvailable","today","ok","hide","cancel","selectMonthBefore","subtract","selectMonthAfter","selectYearBefore","selectYearAfter","selectAM","selectPM","h","okBtn","MONTHS_IN_ALL","Date","getFullYear","MONTHS","currentMonthIndex","low","picker","$scope","calendar","$onInit","days","length","toString","week","high","months","slice","topIndex","getItemAtIndex","index","floor","monthObj","generateMonthCalendar","$watch","val2","val1","nDate","startOfMonth","iNumDay","daysInMonth","iWeek","daysTmp","slices","ceil","j","toDay","substring","isInRange","isSelectedDay","isDateOfTheDay","buildCalendarContent","tbody","querySelector","cal","tbodyHtml","forEach","weekDay","scopeRef","html","join","idx","oldIdx","minuteMode","mode","secondMode","componentRoot","isTouchSupported","EVENTS","POINTER_DOWN","POINTER_UP","POINTER_MOVE","onMoveEvent","closestTarget","currentTarget","closest","clientRect","getClientRects","changedTouches","offsetWidth","pageX","left","y","pageY","top","offsetHeight","ray","sqrt","pow","deg","atan2","PI","val","divider","pointAvailable","setTimeDegRay","off","$on","animateHands","s","rotateElement","WebkitTransform","-moz-transform","-ms-transform","transform","setCurrentValue","nbH","currentValue","tmp","setTime","point","unWatcher","querySelectorAll","clock","pickerEl","w","pL","replace","pR","pT","mL","mR","mT","clockWidth","r","points","sin","cos","style","margin-left","margin-top","display","points24","j24","h24","left24","top24","clockCenter","centerWidth","centerHeight","_hL","_mL","_sL","height","marginTop","exec","isElectron","process","type","define","amd","exports","global"],"mappings":"CAAA,WACE,aAEA,SAASA,EAAqBC,GAC9B,IAAIC,EAAa,uBAGbC,EAAc,CAACC,KAAM,EAAGC,KAAM,EAAGC,OAAQ,GAEzCC,EAAM,SAAUC,EAAIC,GAEtB,OADAD,EAAKE,QAAQC,QAAQH,GACb,qBAAsBI,OAAUA,OAAOC,iBAAiBL,EAAG,IAAIC,GAAQD,EAAGD,IAAIE,IAGpFK,EACF,szNA4EFJ,QAAQK,OAAOb,EAAY,CAAC,eACzBc,QAAQ,mBAAoB,WAC3B,IAAIC,EAAiB,CACnBC,MAAM,EACNC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,OAAQ,aACRC,QAAS,KACTC,QAAS,KACTC,YAAa,KACbC,KAAMd,OAAOe,UAAUC,cAAgBhB,OAAOe,UAAUE,UAAY,KACpEC,UAAW,EACXC,WAAW,EACXC,WAAY,SACZC,OAAQ,KACRC,OAAQ,KACRC,OAAQ,KACRC,UAAU,EACVC,UAAW,QACXC,aAAc,GACdC,UAAU,EACVC,qBAAqB,EACrBC,QAAQ,E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AK,EAAMmB,EAAe,OAE7CzC,IAyEA+C,GACAlC,WAKH/U,EAGT,IAAIkX,EAAaxW,QAAUA,OAAOyW,SAAWzW,OAAOyW,QAAQC,KACtC,mBAAXC,QAAyBA,OAAOC,IACzCD,OAAO,CAAC,UAAWvX,GACQ,oBAAXe,QAA0BA,QAAUA,OAAO0W,SAA+B,mBAAZ5T,UAA4BuT,EAC1GrW,OAAO0W,QAAUzX,EAAqB6D,QAAQ,WAE9C7D,GAAwC,oBAAX0X,OAAyBA,OAAS9W,QAAQX,QArxC3E","file":"angular-material-datetimepicker.min.js","sourcesContent":["(function () {\r\n 'use strict';\r\n\r\n function ngMaterialDatePicker(moment) {\r\n var moduleName = \"ngMaterialDatePicker\";\r\n var mdAccesTime = 'data:image/svg+xml;base64,PHN2ZyBmaWxsPSIjMDAwMDAwIiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4gICAgPHBhdGggZD0iTTExLjk5IDJDNi40NyAyIDIgNi40OCAyIDEyczQuNDcgMTAgOS45OSAxMEMxNy41MiAyMiAyMiAxNy41MiAyMiAxMlMxNy41MiAyIDExLjk5IDJ6TTEyIDIwYy00LjQyIDAtOC0zLjU4LTgtOHMzLjU4LTggOC04IDggMy41OCA4IDgtMy41OCA4LTggOHoiLz4gICAgPHBhdGggZD0iTTAgMGgyNHYyNEgweiIgZmlsbD0ibm9uZSIvPiAgICA8cGF0aCBkPSJNMTIuNSA3SDExdjZsNS4yNSAzLjE1Ljc1LTEuMjMtNC41LTIuNjd6Ii8+PC9zdmc+';\r\n var mdCalendar = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTkgM2gtMVYxaC0ydjJIOFYxSDZ2Mkg1Yy0xLjExIDAtMS45OS45LTEuOTkgMkwzIDE5YzAgMS4xLjg5IDIgMiAyaDE0YzEuMSAwIDItLjkgMi0yVjVjMC0xLjEtLjktMi0yLTJ6bTAgMTZINVY4aDE0djExek03IDEwaDV2NUg3eiIvPjwvc3ZnPg==';\r\n var VIEW_STATES = {DATE: 0, HOUR: 1, MINUTE: 2};\r\n\r\n var css = function (el, name) {\r\n el = angular.element(el);\r\n return ('getComputedStyle' in window) ? window.getComputedStyle(el[0])[name] : el.css(name);\r\n };\r\n\r\n var template =\r\n '' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
{{picker.currentNearestMinute().format(\"dddd\")}}
' +\r\n '
{{picker.params.shortTime?picker.currentDate.format(\"A\"):\" \"}}
' +\r\n '
' +\r\n ' ×' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n '
{{picker.currentDate.format(\"MMM\")|uppercase}}
' +\r\n ' ' +\r\n ' ' +\r\n ' {{itemMonth}}' +\r\n ' ' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
{{picker.currentDate.format(\"DD\")}}
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n '
{{picker.currentDate.format(\"YYYY\")}}
' +\r\n ' ' +\r\n ' ' +\r\n ' {{itemYear}}' +\r\n ' ' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
'+\r\n '
' + //start time\r\n '
' +\r\n '
' +\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime ? \"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}'+\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime ? \"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}:{{picker.currentNearestMinute().format(\"ss\")}}'+\r\n ' {{picker.currentDate.format(\"A\")}}'+\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' {{::picker.params.amText}}' +\r\n '
' +\r\n '
' +\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime?\"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}' +\r\n '
' +\r\n '
' +\r\n ' {{picker.currentNearestMinute().format(picker.params.shortTime?\"hh\":\"HH\")}}:{{picker.currentNearestMinute().format(\"mm\")}}:{{picker.currentNearestMinute().format(\"ss\")}}' +\r\n '
' +\r\n '
' +\r\n ' {{::picker.params.pmText}}' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' ' +\r\n ' {{::picker.params.todayText}}' +\r\n ' {{::picker.params.cancelText}}' +\r\n ' {{::picker.params.okText}}' +\r\n ' ' +\r\n '
';\r\n\r\n angular.module(moduleName, ['ngMaterial'])\r\n .factory('mdcDefaultParams', function () {\r\n var default_params = {\r\n date: true,\r\n time: true,\r\n minutes: true,\r\n seconds: false,\r\n format: 'YYYY-MM-DD',\r\n minDate: null,\r\n maxDate: null,\r\n currentDate: null,\r\n lang: window.navigator.userLanguage || window.navigator.language || 'en',\r\n weekStart: 0,\r\n shortTime: false,\r\n cancelText: 'Cancel',\r\n okText: 'OK',\r\n amText: 'AM',\r\n pmText: 'PM',\r\n todayBtn: true,\r\n todayText: 'Today',\r\n disableDates: [],\r\n weekDays: false,\r\n disableParentScroll: false,\r\n autoOk: false,\r\n editInput: false,\r\n clickOutsideToClose: false,\r\n minuteSteps: 5,\r\n showIcon: false,\r\n showClear: true,\r\n template: template,\r\n templateUrl: '',\r\n targetEvent: null,\r\n openFrom: null,\r\n closeTo: null,\r\n dayOfWeekLen: 1,\r\n hasBackdrop: true,\r\n };\r\n\r\n return function (params) {\r\n if (params) {\r\n for (var i in params) {\r\n if (default_params.hasOwnProperty(i) && params.hasOwnProperty(i)) default_params[i] = params[i];\r\n }\r\n }\r\n return default_params;\r\n };\r\n })\r\n .directive('mdcDatetimePicker', ['$mdDialog', '$timeout', '$compile',\r\n function ($mdDialog, $timeout, $compile) {\r\n return {\r\n restrict: 'A',\r\n require: 'ngModel',\r\n scope: {\r\n currentDate: '=ngModel',\r\n ngModelOptions: '=',\r\n ngChange: '&',\r\n time: '=',\r\n date: '=',\r\n minutes: '=',\r\n seconds: '=',\r\n minDate: '=',\r\n maxDate: '=',\r\n disableDates: '=',\r\n weekDays: '=',\r\n shortTime: '=',\r\n weekStart: '=',\r\n format: '@',\r\n cancelText: '@',\r\n okText: '@',\r\n lang: '@',\r\n amText: '@',\r\n pmText: '@',\r\n showTodaysDate: '@',\r\n todayBtn: '=',\r\n todayText: '@',\r\n disableParentScroll: '=',\r\n autoOk: '=',\r\n editInput: '=',\r\n clickOutsideToClose: '=',\r\n minuteSteps: '=',\r\n showIcon: '=',\r\n showClear: '=',\r\n templateUrl: '@',\r\n dayOfWeekLen: '=',\r\n hasBackdrop: '='\r\n },\r\n link: function (scope, element, attrs, ngModel) {\r\n var isOn = false;\r\n if (!scope.format) {\r\n if (scope.date && scope.time && scope.seconds) scope.format = 'YYYY-MM-DD HH:mm:ss';\r\n else if (scope.date && scope.time) scope.format = 'YYYY-MM-DD HH:mm';\r\n else if (scope.date) scope.format = 'YYYY-MM-DD';\r\n else scope.format = 'HH:mm';\r\n }\r\n\r\n var dateOfTheDay = null;\r\n if (scope.showTodaysDate !== undefined && scope.showTodaysDate !== \"false\") {\r\n dateOfTheDay = moment();\r\n }\r\n\r\n if (angular.isString(scope.currentDate) && scope.currentDate !== '') {\r\n scope.currentDate = moment(scope.currentDate, scope.format);\r\n }\r\n\r\n var offset;\r\n if (ngModel) {\r\n var ngModelOptions = {'*': '$inherit', debounce: 500};\r\n if (angular.version.major === 1 && angular.version.minor > 5) {\r\n ngModel.$options = ngModel.$options.createChild(ngModelOptions);\r\n if (ngModel.$options.getOption('timezone')) offset = ngModel.$options.getOption('timezone');\r\n } else {\r\n if (scope.ngModelOptions && scope.ngModelOptions.timezone) ngModelOptions.timezone = scope.ngModelOptions.timezone;\r\n ngModel.$options = ngModelOptions;\r\n if (ngModel.$options.timezone) offset = ngModel.$options.timezone;\r\n }\r\n if (offset==='utc' || offset==='UTC') offset = 0;\r\n \r\n ngModel.$formatters.push(function (value) {\r\n if (typeof value === 'undefined') return;\r\n var m = moment(value);\r\n return m.isValid() ? m.format(scope.format) : '';\r\n });\r\n \r\n ngModel.$parsers.push(function (value) {\r\n if (typeof value === 'undefined') return;\r\n \r\n var m = moment(value, scope.format);\r\n if (offset !== undefined) m.utcOffset(offset, m._tzm === undefined);\r\n if (scope.minDate) ngModel.$setValidity('min', !m.isBefore(scope.minDate));\r\n if (scope.maxDate) ngModel.$setValidity('max', !m.isAfter(scope.maxDate));\r\n ngModel.$setValidity('format', moment(value, scope.format, true).isValid());\r\n\r\n return m.isValid() ? (m._isUTC ? m : m.toDate()) : '';\r\n });\r\n \r\n }\r\n\r\n function openCalendar(e) {\r\n e.preventDefault();\r\n element.blur();\r\n element.parent().removeClass('md-input-focused');\r\n if (isOn) {\r\n return;\r\n }\r\n isOn = true;\r\n var options = {};\r\n for (var i in attrs) {\r\n if (scope.hasOwnProperty(i) && !angular.isUndefined(scope[i])) {\r\n options[i] = scope[i];\r\n }\r\n }\r\n options.currentDate = scope.currentDate;\r\n options.showTodaysDate = dateOfTheDay;\r\n\r\n var dialogOptions = {\r\n controller: PluginController,\r\n controllerAs: 'picker',\r\n locals: {options: options},\r\n openFrom: element,\r\n closeTo: element,\r\n parent: angular.element(document.body),\r\n bindToController: true,\r\n clickOutsideToClose: options.clickOutsideToClose || false,\r\n disableParentScroll: options.disableParentScroll || false,\r\n hasBackdrop: options.hasBackdrop === undefined ? true : options.hasBackdrop,\r\n skipHide: true,\r\n multiple: true,\r\n };\r\n\r\n if (!options.templateUrl) dialogOptions.template = template;\r\n else dialogOptions.templateUrl = options.templateUrl;\r\n \r\n $mdDialog.show(dialogOptions).then(function(v) {\r\n\r\n if (offset !== undefined) v.utcOffset(offset, true);\r\n\r\n scope.currentDate = v && !v._isUTC ? v.toDate() : v;\r\n ngModel.$setValidity('format', true);\r\n ngModel.$setViewValue(scope.currentDate);\r\n ngModel.$setDirty();\r\n isOn = false;\r\n\r\n if (!moment(scope.currentDate).isSame(options.currentDate)) {\r\n $timeout(scope.ngChange, 0);\r\n }\r\n\r\n element.parent().removeClass('md-input-focused');\r\n }, function () {\r\n isOn = false;\r\n element.parent().removeClass('md-input-focused');\r\n });\r\n }\r\n\r\n if (!scope.editInput) {\r\n if (scope.showIcon) {\r\n element.on('click', openCalendar);\r\n } else {\r\n element.on('focus', openCalendar);\r\n }\r\n }\r\n \r\n if (scope.showIcon) {\r\n element.addClass('dtp-no-msclear dtp-input');\r\n var calendarButton =\r\n '' +\r\n '' +\r\n '',\r\n clearButton = scope.showClear === undefined || scope.showClear ? '' : '';\r\n element.after($compile(calendarButton + clearButton)(scope));\r\n\r\n scope.openCalendarDiag = function(e) {\r\n openCalendar(e);\r\n };\r\n\r\n scope.clear = function() {\r\n ngModel.$setViewValue(null);\r\n scope.currentDate = null;\r\n ngModel.$render();\r\n $timeout(function() {\r\n scope.ngChange();\r\n element[0].focus();\r\n }, 0, false);\r\n };\r\n }\r\n }\r\n };\r\n }])\r\n // Returns a service that opens a dialog when the attribute shown is called\r\n .factory('mdcDateTimeDialog', [\"$mdDialog\", \"$q\", function ($mdDialog, $q) {\r\n var service = {\r\n show: function (options) {\r\n var deferred = $q.defer();\r\n\r\n if (options.showTodaysDate !== undefined && options.showTodaysDate !== \"false\") options.showTodaysDate = moment();\r\n\r\n var dialogOptions = {\r\n controller: PluginController,\r\n controllerAs: 'picker',\r\n locals: {options: options},\r\n parent: angular.element(document.body),\r\n bindToController: true,\r\n clickOutsideToClose: options.clickOutsideToClose || false,\r\n disableParentScroll: options.disableParentScroll || false,\r\n skipHide: true,\r\n multiple: true,\r\n hasBackdrop: options.hasBackdrop === undefined ? true : options.hasBackdrop,\r\n targetEvent: options.targetEvent,\r\n openFrom: options.openFrom,\r\n closeTo: options.closeTo,\r\n };\r\n\r\n if (!options.templateUrl) dialogOptions.template = template;\r\n else dialogOptions.templateUrl = options.templateUrl;\r\n\r\n $mdDialog.show(dialogOptions).then(function (v) {\r\n deferred.resolve(v && !v._isUTC ? v.toDate() : v);\r\n }, function () {\r\n deferred.reject();\r\n });\r\n return deferred.promise;\r\n }\r\n };\r\n\r\n return service;\r\n }])\r\n ;\r\n\r\n var PluginController = function ($mdDialog, mdcDefaultParams) {\r\n this.currentView = VIEW_STATES.DATE;\r\n this._dialog = $mdDialog;\r\n\r\n this._attachedEvents = [];\r\n this.VIEWS = VIEW_STATES;\r\n this.params = angular.copy(mdcDefaultParams());\r\n this.meridien = 'AM';\r\n this.params = angular.extend(this.params, this.options);\r\n\r\n this.init();\r\n };\r\n\r\n PluginController.$inject = ['$mdDialog', 'mdcDefaultParams'];\r\n PluginController.prototype = {\r\n init: function () {\r\n this.timeMode = this.params.time && !this.params.date;\r\n this.dateMode = this.params.date;\r\n this.initDates();\r\n this.start();\r\n },\r\n currentNearestMinute: function () {\r\n var nearestMin = this.params.minuteSteps;\r\n if (nearestMin < 1 || nearestMin > 59) nearestMin = 1;\r\n\r\n var date = this.currentDate || moment();\r\n var minutes = (nearestMin * Math.round(date.minute() / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n\r\n var seconds;\r\n if (this.params.seconds) {\r\n seconds = date.second();\r\n if (seconds >= 60) seconds = 60 - 1;\r\n } else seconds = 0;\r\n\r\n return moment(date).minutes(minutes).seconds(seconds).millisecond(0);\r\n },\r\n initDates: function () {\r\n var that = this;\r\n var _dateParam = function (input, fallback) {\r\n var ret = null;\r\n if (angular.isDefined(input) && input !== null && input !== '') {\r\n if (angular.isString(input)) {\r\n if (typeof(that.params.format) !== 'undefined' && that.params.format !== null) {\r\n ret = moment(input, that.params.format).locale(that.params.lang);\r\n }\r\n else {\r\n ret = moment(input).locale(that.params.lang);\r\n }\r\n } else if (typeof input === 'number') {\r\n ret = moment(input).locale(that.params.lang);\r\n } else {\r\n if (angular.isDate(input)) {\r\n var x = input.getTime();\r\n ret = moment(x, \"x\").locale(that.params.lang);\r\n } else if (moment.isMoment(input)) {\r\n if (input.isValid()) ret = input;\r\n else ret = fallback;\r\n }\r\n }\r\n } else {\r\n ret = fallback;\r\n }\r\n return ret;\r\n };\r\n\r\n this.currentDate = _dateParam(this.params.currentDate, moment());\r\n this.currentDate = this.currentNearestMinute();\r\n this.minDate = _dateParam(this.params.minDate);\r\n this.maxDate = _dateParam(this.params.maxDate);\r\n this.disableDates = this.params.disableDates.map(function (x) {\r\n return moment(x).format('MMMM Do YYYY');\r\n });\r\n this.selectDate(this.currentDate);\r\n this.weekDays = this.params.weekDays;\r\n },\r\n initDate: function () {\r\n this.currentView = VIEW_STATES.DATE;\r\n },\r\n initHours: function () {\r\n this.currentView = VIEW_STATES.HOUR;\r\n },\r\n initMinutes: function () {\r\n this.currentView = VIEW_STATES.MINUTE;\r\n },\r\n initSeconds: function () {\r\n this.currentView = VIEW_STATES.SECOND;\r\n },\r\n isAfterMinDate: function (date, checkHour, checkMinute) {\r\n var _return = true;\r\n\r\n if (typeof(this.minDate) !== 'undefined' && this.minDate !== null) {\r\n var _minDate = moment(this.minDate);\r\n var _date = moment(date);\r\n\r\n if (!checkHour && !checkMinute) {\r\n _minDate.hour(0);\r\n _minDate.minute(0);\r\n\r\n _date.hour(0);\r\n _date.minute(0);\r\n }\r\n\r\n _minDate.second(0);\r\n _date.second(0);\r\n _minDate.millisecond(0);\r\n _date.millisecond(0);\r\n\r\n if (!checkMinute) {\r\n _date.minute(0);\r\n _minDate.minute(0);\r\n\r\n _return = (parseInt(_date.format(\"X\")) >= parseInt(_minDate.format(\"X\")));\r\n }\r\n else {\r\n _return = (parseInt(_date.format(\"X\")) >= parseInt(_minDate.format(\"X\")));\r\n }\r\n }\r\n\r\n return _return;\r\n },\r\n isBeforeMaxDate: function (date, checkTime, checkMinute) {\r\n var _return = true;\r\n\r\n if (typeof(this.maxDate) !== 'undefined' && this.maxDate !== null) {\r\n var _maxDate = moment(this.maxDate);\r\n var _date = moment(date);\r\n\r\n if (!checkTime && !checkMinute) {\r\n _maxDate.hour(0);\r\n _maxDate.minute(0);\r\n\r\n _date.hour(0);\r\n _date.minute(0);\r\n }\r\n\r\n _maxDate.second(0);\r\n _date.second(0);\r\n _maxDate.millisecond(0);\r\n _date.millisecond(0);\r\n\r\n if (!checkMinute) {\r\n _date.minute(0);\r\n _maxDate.minute(0);\r\n\r\n _return = (parseInt(_date.format(\"X\")) <= parseInt(_maxDate.format(\"X\")));\r\n }\r\n else {\r\n _return = (parseInt(_date.format(\"X\")) <= parseInt(_maxDate.format(\"X\")));\r\n }\r\n }\r\n\r\n return _return;\r\n },\r\n isInDisableDates: function (date) {\r\n var dut = date.format('MMMM Do YYYY');\r\n if (this.disableDates.indexOf(dut) > -1) {\r\n return false;\r\n }\r\n return true;\r\n },\r\n isWeekDay: function(date) {\r\n if (this.weekDays) {\r\n if (date.isoWeekday() <= 5) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n return true;\r\n },\r\n selectDate: function (date) {\r\n if (date) {\r\n this.currentDate = moment(date);\r\n if (!this.isAfterMinDate(this.currentDate, true, true)) {\r\n this.currentDate = moment(this.minDate);\r\n }\r\n\r\n if (!this.isBeforeMaxDate(this.currentDate, true, true)) {\r\n this.currentDate = moment(this.maxDate);\r\n }\r\n this.currentDate.locale(this.params.lang);\r\n this.calendarStart = moment(this.currentDate);\r\n this.meridien = this.currentDate.hour() >= 12 ? 'PM' : 'AM';\r\n }\r\n },\r\n isPM: function () {\r\n return this.meridien === 'PM';\r\n },\r\n incrementMonth: function (amount) {\r\n if (amount === 1 && this.isNextMonthVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'month'));\r\n }\r\n\r\n if (amount === -1 && this.isPreviousMonthVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'month'));\r\n }\r\n },\r\n incrementYear: function (amount) {\r\n if (amount === 1 && this.isNextYearVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'year'));\r\n }\r\n\r\n if (amount === -1 && this.isPreviousYearVisible()) {\r\n this.selectDate(this.currentDate.add(amount, 'year'));\r\n }\r\n },\r\n openMenu: function ($mdMenu, ev) {\r\n $mdMenu.open(ev); \r\n },\r\n monthsAvailable: function () {\r\n var monthsArr = [], \r\n _date = moment(this.currentDate);\r\n\r\n for (var m = 0; m < 12; m++) {\r\n var curMonth = _date.month(m);\r\n if (this.isAfterMinDate(curMonth.endOf('month')) && this.isBeforeMaxDate(curMonth.startOf('month'))) {\r\n monthsArr.push(curMonth.format('MMMM'));\r\n }\r\n }\r\n return monthsArr;\r\n },\r\n selectMonth: function (month) {\r\n this.selectDate(this.currentDate.month(month));\r\n },\r\n yearsAvailable: function () {\r\n var _minDate, _maxDate, len, startYear, yearsArr = [],\r\n _date = this.currentDate.year();\r\n\r\n if (typeof(this.minDate) !== 'undefined' && this.minDate !== null) {\r\n _minDate = moment(this.minDate).year();\r\n }\r\n if (typeof(this.maxDate) !== 'undefined' && this.maxDate !== null) {\r\n _maxDate = moment(this.maxDate).year();\r\n }\r\n\r\n if (_maxDate && _minDate) {\r\n len = _maxDate - _minDate;\r\n startYear = _minDate;\r\n } else if (_minDate) {\r\n len = 115;\r\n startYear = _minDate;\r\n } else if (_maxDate) {\r\n len = 30;\r\n startYear = _maxDate - len;\r\n } else {\r\n len = 60;\r\n startYear = _date - len/2;\r\n }\r\n \r\n for (var i=0; i <= len; i++) {\r\n yearsArr.push(startYear+i);\r\n }\r\n return yearsArr;\r\n },\r\n selectYear: function (year) {\r\n this.selectDate(this.currentDate.year(year));\r\n },\r\n isPreviousMonthVisible: function () {\r\n return this.calendarStart && this.isAfterMinDate(moment(this.calendarStart).startOf('month'), false, false);\r\n },\r\n isNextMonthVisible: function () {\r\n return this.calendarStart && this.isBeforeMaxDate(moment(this.calendarStart).endOf('month'), false, false);\r\n },\r\n isPreviousYearVisible: function () {\r\n return this.calendarStart && this.isAfterMinDate(moment(this.calendarStart).startOf('year'), false, false);\r\n },\r\n isNextYearVisible: function () {\r\n return this.calendarStart && this.isBeforeMaxDate(moment(this.calendarStart).endOf('year'), false, false);\r\n },\r\n isHourAvailable: function (hour) {\r\n var _date = moment(this.currentDate);\r\n if (this.params.shortTime) {\r\n _date.hour(this.convertHours(hour)).minute(0).second(0);\r\n } else {\r\n _date.hour(hour).minute(0).second(0);\r\n }\r\n return this.isAfterMinDate(_date, true, false) && this.isBeforeMaxDate(_date, true, false);\r\n },\r\n isMinuteAvailable: function (minute) {\r\n var _date = moment(this.currentDate);\r\n _date.minute(minute).second(0);\r\n\r\n var nearestMin = this.params.minuteSteps;\r\n if (nearestMin > 1 && 5 % nearestMin !== 0){\r\n var _curmin = _date.minute();\r\n var minutes = (nearestMin * Math.round(_curmin / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n if (minutes !== _curmin) return false;\r\n }\r\n\r\n return this.isAfterMinDate(_date, true, true) && this.isBeforeMaxDate(_date, true, true);\r\n },\r\n isSecondAvailable: function (second) {\r\n return true;\r\n },\r\n start: function () {\r\n this.currentView = VIEW_STATES.DATE;\r\n if (this.params.date) {\r\n this.initDate();\r\n } else {\r\n if (this.params.time) {\r\n this.initHours();\r\n }\r\n }\r\n },\r\n today: function () {\r\n var nearestMin = this.params.minuteSteps;\r\n var date = moment();\r\n var minutes = (nearestMin * Math.round(date.minute() / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n\r\n var seconds;\r\n if (this.params.seconds) {\r\n seconds = date.second();\r\n if (seconds >= 60) seconds = 60 - 1;\r\n } else seconds = 0;\r\n\r\n this.selectDate(moment(date).minutes(minutes).seconds(seconds).millisecond(0));\r\n },\r\n ok: function () {\r\n switch (this.currentView) {\r\n case VIEW_STATES.DATE:\r\n if (this.params.time === true) {\r\n this.initHours();\r\n } else {\r\n this.hide(true);\r\n }\r\n break;\r\n case VIEW_STATES.HOUR:\r\n if (this.params.minutes === true) {\r\n this.initMinutes();\r\n } else {\r\n this.hide(true);\r\n }\r\n break;\r\n case VIEW_STATES.MINUTE:\r\n if (this.params.seconds === true) {\r\n this.initSeconds();\r\n } else {\r\n this.hide(true);\r\n }\r\n break;\r\n case VIEW_STATES.SECOND:\r\n this.hide(true);\r\n break;\r\n }\r\n },\r\n cancel: function () {\r\n if (this.params.time) {\r\n switch (this.currentView) {\r\n case VIEW_STATES.DATE:\r\n this.hide();\r\n break;\r\n case VIEW_STATES.HOUR:\r\n if (this.params.date) {\r\n this.initDate();\r\n }\r\n else {\r\n this.hide();\r\n }\r\n break;\r\n case VIEW_STATES.MINUTE:\r\n this.initHours();\r\n break;\r\n case VIEW_STATES.SECOND:\r\n this.initMinutes();\r\n break;\r\n }\r\n }\r\n else {\r\n this.hide();\r\n }\r\n },\r\n selectMonthBefore: function () {\r\n this.calendarStart.subtract(1, 'months');\r\n },\r\n selectMonthAfter: function () {\r\n this.calendarStart.add(1, 'months');\r\n },\r\n selectYearBefore: function () {\r\n this.calendarStart.subtract(1, 'years');\r\n },\r\n selectYearAfter: function () {\r\n this.calendarStart.add(1, 'years');\r\n },\r\n selectAM: function () {\r\n if (this.isHourAvailable(0) || this.isHourAvailable(12)) {\r\n if (this.currentDate.hour() >= 12) {\r\n this.selectDate(this.currentDate.subtract(12, 'hours'));\r\n }\r\n if (!this.isHourAvailable(this.currentDate.hour())) {\r\n this.selectDate(this.currentDate.hour(this.minDate.hour()));\r\n }\r\n if (!this.isMinuteAvailable(this.currentDate.minute())) {\r\n this.selectDate(this.currentDate.minute(this.minDate.minute()));\r\n }\r\n }\r\n },\r\n selectPM: function () {\r\n if (this.isHourAvailable(12) || this.isHourAvailable(24)) {\r\n if (this.currentDate.hour() < 12) {\r\n this.selectDate(this.currentDate.add(12, 'hours'));\r\n }\r\n if (!this.isHourAvailable(this.currentDate.hour())) {\r\n this.selectDate(this.currentDate.hour(this.maxDate.hour()));\r\n }\r\n if (!this.isMinuteAvailable(this.currentDate.minute())) {\r\n this.selectDate(this.currentDate.minute(this.maxDate.minute()));\r\n }\r\n }\r\n },\r\n convertHours: function (h) {\r\n var _return = h;\r\n if (h < 12 && this.isPM()) _return += 12;\r\n\r\n return _return;\r\n },\r\n hide: function (okBtn) {\r\n if (okBtn) this._dialog.hide(this.currentDate);\r\n else this._dialog.cancel();\r\n }\r\n };\r\n\r\n angular.module(moduleName)\r\n .directive('mdcDatetimePickerCalendar', [\r\n function () {\r\n\r\n var YEAR_MIN = 1920,\r\n YEAR_MAX = new Date().getFullYear() + 30,\r\n MONTHS_IN_ALL = (YEAR_MAX - YEAR_MIN + 1) * 12,\r\n ITEM_HEIGHT = 240,\r\n MONTHS = [];\r\n for (var i = 0; i < MONTHS_IN_ALL; i++) {\r\n MONTHS.push(i);\r\n }\r\n\r\n var currentMonthIndex = function (date, low) {\r\n low = low ? low : 0;\r\n var year = date.year();\r\n var month = date.month();\r\n return (((year - YEAR_MIN) * 12) + month - 1) - low;\r\n };\r\n\r\n return {\r\n restrict: 'E',\r\n scope: {\r\n picker: '=',\r\n date: '='\r\n },\r\n bindToController: true,\r\n controllerAs: 'cal',\r\n controller: ['$scope', function ($scope) {\r\n var calendar = this, picker;\r\n\r\n this.$onInit = function () {\r\n picker = this.picker;\r\n\r\n var days = [];\r\n for (var i = picker.params.weekStart; days.length < 7; i++) {\r\n if (i > 6) i = 0;\r\n days.push(i.toString());\r\n }\r\n calendar.week = days;\r\n\r\n if (!picker.maxDate && !picker.minDate) {\r\n calendar.months = MONTHS;\r\n } else {\r\n var low = picker.minDate ? currentMonthIndex(picker.minDate) : 0;\r\n var high = picker.maxDate ? (currentMonthIndex(picker.maxDate) + 1) : MONTHS_IN_ALL;\r\n calendar.months = MONTHS.slice(low, high);\r\n }\r\n\r\n calendar.topIndex = currentMonthIndex(picker.currentDate) - calendar.months[0];\r\n };\r\n\r\n if (angular.version.major === 1 && angular.version.minor < 5) this.$onInit();\r\n \r\n calendar.getItemAtIndex = function (index) {\r\n var month = ((index + 1) % 12) || 12;\r\n var year = YEAR_MIN + Math.floor(index / 12);\r\n var monthObj = moment(picker.currentDate).year(year).month(month);\r\n return generateMonthCalendar(monthObj);\r\n };\r\n\r\n $scope.$watch(function () {\r\n return picker.currentDate ? picker.currentDate.format('YYYY-MM') : '';\r\n }, function (val2, val1) {\r\n if (val2 != val1) {\r\n var nDate = moment(val2, 'YYYY-MM');\r\n var low = picker.minDate ? currentMonthIndex(picker.minDate) : 0;\r\n var index = currentMonthIndex(nDate, low);\r\n if (calendar.topIndex != index) {\r\n calendar.topIndex = index;\r\n }\r\n }\r\n });\r\n\r\n var generateMonthCalendar = function (date) {\r\n var month = {};\r\n if (date !== null) {\r\n month.name = date.format('MMMM YYYY');\r\n var startOfMonth = moment(date).locale(picker.params.lang).startOf('month')\r\n .hour(date.hour())\r\n .minute(date.minute());\r\n var iNumDay = startOfMonth.format('d');\r\n month.days = [];\r\n for (var i = startOfMonth.date(); i <= startOfMonth.daysInMonth(); i++) {\r\n if (i === startOfMonth.date()) {\r\n var iWeek = calendar.week.indexOf(iNumDay.toString());\r\n if (iWeek > 0) {\r\n for (var x = 0; x < iWeek; x++) {\r\n month.days.push(0);\r\n }\r\n }\r\n }\r\n month.days.push(moment(startOfMonth).locale(picker.params.lang).date(i));\r\n }\r\n\r\n var daysInAWeek = 7, daysTmp = [], slices = Math.ceil(month.days.length / daysInAWeek);\r\n for (var j = 0; j < slices; j++) {\r\n daysTmp.push(month.days.slice(j * daysInAWeek, (j + 1) * daysInAWeek));\r\n }\r\n month.days = daysTmp;\r\n return month;\r\n }\r\n\r\n };\r\n\r\n calendar.toDay = function (i) {\r\n return moment(parseInt(i), \"d\")\r\n .locale(picker.params.lang)\r\n .format(\"ddd\")\r\n .substring(0, picker.params.dayOfWeekLen);\r\n };\r\n\r\n calendar.isInRange = function (date) {\r\n return picker.isAfterMinDate(moment(date), false, false) &&\r\n picker.isBeforeMaxDate(moment(date), false, false) &&\r\n picker.isWeekDay(moment(date)) &&\r\n picker.isInDisableDates(moment(date));\r\n };\r\n\r\n calendar.selectDate = function (date) {\r\n if (date) {\r\n if (calendar.isSelectedDay(date)) {\r\n return picker.ok();\r\n }\r\n picker.selectDate(moment(date).hour(calendar.date.hour()).minute(calendar.date.minute()));\r\n if (picker.params.autoOk) {\r\n picker.ok();\r\n }\r\n }\r\n };\r\n\r\n calendar.isSelectedDay = function (m) {\r\n return m && calendar.date.date() === m.date() && calendar.date.month() === m.month() && calendar.date.year() === m.year();\r\n };\r\n\r\n calendar.isDateOfTheDay = function (m) {\r\n var today = calendar.picker.options.showTodaysDate;\r\n if (!today) {\r\n return false;\r\n }\r\n\r\n return m && today.date() === m.date() && today.month() === m.month() && today.year() === m.year();\r\n };\r\n }],\r\n template: \r\n '' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
'\r\n };\r\n }])\r\n .directive('mdcDatetimePickerCalendarMonth', ['$compile',\r\n function ($compile) {\r\n var buildCalendarContent = function (element, scope) {\r\n var tbody = angular.element(element[0].querySelector('tbody'));\r\n var calendar = scope.cal, month = scope.month;\r\n\r\n var tbodyHtml = [];\r\n\r\n month.days.forEach(function (weekDays, i) {\r\n tbodyHtml.push('');\r\n weekDays.forEach(function (weekDay, j) {\r\n tbodyHtml.push('');\r\n if (weekDay) {\r\n if (calendar.isInRange(weekDay)) {\r\n //build a\r\n var scopeRef = 'month[\\'days\\'][' + i + '][' + j + ']';\r\n\r\n tbodyHtml.push('');\r\n tbodyHtml.push(weekDay.format('D'));\r\n tbodyHtml.push('');\r\n } else {\r\n tbodyHtml.push('');\r\n tbodyHtml.push(weekDay.format('D'));\r\n tbodyHtml.push('');\r\n }\r\n }\r\n tbodyHtml.push('');\r\n });\r\n tbodyHtml.push('');\r\n });\r\n\r\n tbody.html(tbodyHtml.join(''));\r\n $compile(tbody)(scope);\r\n };\r\n\r\n return {\r\n scope: {\r\n idx: '='\r\n },\r\n require: '^mdcDatetimePickerCalendar',\r\n restrict: 'AE',\r\n template: \r\n '
{{month.name}}
' +\r\n '' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n ' ' +\r\n '
{{cal.toDay(day)}}
',\r\n link: function (scope, element, attrs, calendar) {\r\n scope.cal = calendar;\r\n scope.month = calendar.getItemAtIndex(parseInt(scope.idx));\r\n buildCalendarContent(element, scope);\r\n scope.$watch(function () {\r\n return scope.idx;\r\n }, function (idx, oldIdx) {\r\n if (idx != oldIdx) {\r\n scope.month = calendar.getItemAtIndex(parseInt(scope.idx));\r\n buildCalendarContent(element, scope);\r\n }\r\n });\r\n }\r\n };\r\n }\r\n ])\r\n ;\r\n\r\n angular.module(moduleName)\r\n .directive('mdcDtpNoclick', function () {\r\n return {\r\n link: function (scope, el) {\r\n el.on('click', function (e) {\r\n e.preventDefault();\r\n });\r\n }\r\n };\r\n });\r\n angular.module(moduleName)\r\n .directive('mdcDatetimePickerClock', ['$timeout',\r\n function ($timeout) {\r\n\r\n var template = \r\n '
 ' +\r\n '
' +\r\n ' {{point.display}}' +\r\n ' {{point.display}}' +\r\n '
' +\r\n '
' +\r\n ' {{point24.display}}' +\r\n ' {{point24.display}}' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
';\r\n\r\n return {\r\n restrict: 'E',\r\n template: template,\r\n link: function (scope, element, attrs) {\r\n var minuteMode = attrs.mode === 'minutes';\r\n var secondMode = attrs.mode === 'seconds';\r\n var picker = scope.picker;\r\n //banking on the fact that there will only be one at a time\r\n var componentRoot = document.querySelector('md-dialog.dtp');\r\n\r\n var setTimeDegRay = function(deg, ray) {\r\n var val = 0;\r\n deg = deg >= 360 ? 0 : deg;\r\n if (deg !== 0) {\r\n var divider = minuteMode||secondMode ? 60 : 12;\r\n val = Math.round(divider / 360 * deg);\r\n }\r\n\r\n if (minuteMode) {\r\n var nearestMin = picker.params.minuteSteps;\r\n if (nearestMin < 1 || nearestMin > 59) nearestMin = 1;\r\n var minutes = (nearestMin * Math.round(val / nearestMin));\r\n if (minutes >= 60) minutes = 60 - nearestMin;\r\n if (!scope.pointAvailable({value: val})) return;\r\n picker.currentDate.minute(minutes);\r\n } else if (!secondMode){\r\n if (val === 12) val = 0;\r\n if (!picker.params.shortTime) picker.meridien = ray > 84 ? 'AM' : 'PM';\r\n if (picker.isPM()) val += 12;\r\n if (!scope.pointAvailable({value: val})) return;\r\n picker.currentDate.hour(val);\r\n } else {\r\n if (val >= 60) val = 0;\r\n if (!scope.pointAvailable({value: val})) return;\r\n picker.currentDate.second(val);\r\n }\r\n };\r\n\r\n var isTouchSupported = ('ontouchstart' in window) ? true : false,\r\n EVENTS = {\r\n POINTER_DOWN : isTouchSupported ? 'touchstart' : 'mousedown',\r\n POINTER_UP : isTouchSupported ? 'touchend' : 'mouseup',\r\n POINTER_MOVE : isTouchSupported ? 'touchmove' : 'mousemove'\r\n };\r\n\r\n var onMoveEvent = function(e) {\r\n e.preventDefault();\r\n\r\n var closestTarget = e.currentTarget.closest('div'),\r\n clientRect = closestTarget.getClientRects()[0];\r\n\r\n if (isTouchSupported) e = e.changedTouches[0];\r\n \r\n var x = ((closestTarget.offsetWidth / 2) - (e.pageX - clientRect.left)),\r\n y = ((e.pageY - clientRect.top) - (closestTarget.offsetHeight / 2));\r\n\r\n var ray = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)),\r\n deg = Math.round((Math.atan2(x, y) * (180 / Math.PI)));\r\n\r\n $timeout(function() {\r\n setTimeDegRay(deg+180, ray);\r\n });\r\n };\r\n\r\n element.on(EVENTS.POINTER_DOWN, function() {\r\n element.on(EVENTS.POINTER_MOVE, onMoveEvent);\r\n });\r\n\r\n element.on(EVENTS.POINTER_UP, function() {\r\n element.off(EVENTS.POINTER_MOVE);\r\n });\r\n\r\n scope.$on(\"$destroy\", function() {\r\n element.off(EVENTS.POINTER_MOVE, onMoveEvent); \r\n });\r\n\r\n var exec = function () {\r\n var clock = angular.element(element[0].querySelector('.dtp-picker-clock')),\r\n pickerEl = angular.element(componentRoot.querySelector('.dtp-picker'));\r\n\r\n var w = componentRoot.querySelector('.dtp-content').offsetWidth;\r\n var pL = parseInt(css(pickerEl, 'paddingLeft').replace('px', '')) || 0;\r\n var pR = parseInt(css(pickerEl, 'paddingRight').replace('px', '')) || 0;\r\n var pT = parseInt(css(pickerEl, 'paddingTop').replace('px', '')) || 0;\r\n var mL = parseInt(css(clock, 'marginLeft').replace('px', '')) || 0;\r\n var mR = parseInt(css(clock, 'marginRight').replace('px', '')) || 0;\r\n var mT = parseInt(css(clock, 'marginTop').replace('px', '')) || 0;\r\n\r\n //set width\r\n var clockWidth = (w - (mL + mR + pL + pR));\r\n clock.css('width', (clockWidth) + 'px');\r\n\r\n var r = (clockWidth / 2);\r\n var j = r / 1.2; // radius for low number\r\n\r\n var points = [];\r\n\r\n for (var h = 0; h < 12; ++h) {\r\n var x = j * Math.sin(Math.PI * 2 * (h / 12));\r\n var y = j * Math.cos(Math.PI * 2 * (h / 12));\r\n var left = (r + x + pL / 2) - (pL + mL);\r\n var top = (r - y - mT / 2) - (pT + mT);\r\n\r\n var hour = {\r\n left: left,\r\n top: top,\r\n value: (minuteMode||secondMode ? (h * 5) : h), //5 for minute 60/12\r\n style: {'margin-left': left + 'px', 'margin-top': top + 'px'}\r\n };\r\n\r\n if (minuteMode || secondMode) {\r\n hour.display = hour.value < 10 ? ('0' + hour.value) : hour.value;\r\n } else {\r\n if (picker.params.shortTime) {\r\n hour.display = h === 0 ? 12 : h;\r\n } else {\r\n hour.display = h;\r\n }\r\n }\r\n\r\n points.push(hour);\r\n }\r\n scope.points = points;\r\n\r\n if (!picker.params.shortTime && !minuteMode && !secondMode) {\r\n var points24 = [];\r\n\r\n var j24 = r / 1.8; // radius for high number\r\n for (var h24 = 12; h24 < 24; ++h24) {\r\n var x24 = j24 * Math.sin(Math.PI * 2 * (h24 / 12));\r\n var y24 = j24 * Math.cos(Math.PI * 2 * (h24 / 12));\r\n var left24 = (r + x24 + pL / 2) - (pL + mL);\r\n var top24 = (r - y24 - mT / 2) - (pT + mT);\r\n\r\n points24.push({\r\n left: left24,\r\n top: top24,\r\n value: h24,\r\n display: h24,\r\n style: {'margin-left': left24 + 'px', 'margin-top': top24 + 'px'}\r\n });\r\n }\r\n scope.points24 = points24;\r\n }\r\n\r\n scope.mode = attrs.mode;\r\n setCurrentValue();\r\n clock.css('height', clockWidth + 'px');\r\n\r\n var clockCenter = element[0].querySelector('.dtp-clock-center');\r\n var centerWidth = (clockCenter.offsetWidth / 2) || 7.5;\r\n var centerHeight = (clockCenter.offsetHeight / 2) || 7.5;\r\n var _hL = r / (picker.params.shortTime ? 1.8 : 2.3);\r\n var _mL = r / 1.4;\r\n var _sL = r;\r\n\r\n angular.element(element[0].querySelector('.dtp-hour-hand')).css({\r\n left: r + (mL * 1.5) + 'px',\r\n height: _hL + 'px',\r\n marginTop: (r - _hL - pL) + 'px'\r\n }).addClass(!minuteMode && !secondMode ? 'on' : '');\r\n\r\n angular.element(element[0].querySelector('.dtp-minute-hand')).css({\r\n left: r + (mL * 1.5) + 'px',\r\n height: _mL + 'px',\r\n marginTop: r - _mL - pL + 'px'\r\n }).addClass(minuteMode ? 'on' : '');\r\n\r\n angular.element(element[0].querySelector('.dtp-second-hand')).css({\r\n left: r + (mL * 1.5) + 'px',\r\n height: _sL + 'px',\r\n marginTop: r - _sL - pL + 'px'\r\n }).addClass(secondMode ? 'on' : '');\r\n\r\n angular.element(clockCenter).css({\r\n left: r + pL + mL - centerWidth + 'px',\r\n marginTop: (r - (mL / 2)) - centerHeight + 'px'\r\n });\r\n animateHands();\r\n };\r\n\r\n var animateHands = function () {\r\n var _date = picker.currentNearestMinute();\r\n var h = _date.hour(), m = _date.minute(), s = _date.second();\r\n\r\n rotateElement(angular.element(element[0].querySelector('.dtp-hour-hand')), 30 * h);\r\n rotateElement(angular.element(element[0].querySelector('.dtp-minute-hand')), 6 * m);\r\n rotateElement(angular.element(element[0].querySelector('.dtp-second-hand')), 6 * s);\r\n };\r\n\r\n var rotateElement = function (el, deg) {\r\n angular.element(el).css({\r\n WebkitTransform: 'rotate(' + deg + 'deg)',\r\n '-moz-transform': 'rotate(' + deg + 'deg)',\r\n '-ms-transform': 'rotate(' + deg + 'deg)',\r\n 'transform': 'rotate(' + deg + 'deg)'\r\n });\r\n };\r\n\r\n\r\n var setCurrentValue = function () {\r\n var date = picker.currentNearestMinute();\r\n var nbH = picker.params.shortTime ? 12 : 24;\r\n if (minuteMode) scope.currentValue = date.minute();\r\n else if (secondMode) scope.currentValue = date.second();\r\n else scope.currentValue = date.hour() % nbH;\r\n };\r\n\r\n scope.$watch(function () {\r\n var tmp = picker.currentNearestMinute();\r\n return tmp ? tmp.format('HH:mm:ss') : '';\r\n }, function () {\r\n setCurrentValue();\r\n animateHands();\r\n });\r\n\r\n scope.setTime = function (val) {\r\n if (!minuteMode && !secondMode) {\r\n if (val === scope.currentValue && !picker.params.autoOk) picker.ok(); // double click\r\n\r\n if (picker.params.shortTime) {\r\n picker.currentDate.hour(picker.isPM() ? (val + 12) : val);\r\n } else {\r\n picker.currentDate.hour(val);\r\n if (val >= 12) picker.meridien = 'PM';\r\n else picker.meridien = 'AM';\r\n }\r\n\r\n if (picker.params.autoOk) picker.ok(); // single click\r\n } else if (!secondMode) {\r\n if (val === scope.currentValue && !picker.params.seconds) picker.ok(); // double click\r\n \r\n picker.currentDate.minute(val);\r\n if (!picker.params.seconds) {\r\n picker.currentDate.second(0);\r\n } else if (picker.params.autoOk) picker.ok(); // single click\r\n } else {\r\n if (val === scope.currentValue) picker.ok(); // double click\r\n picker.currentDate.second(val);\r\n }\r\n };\r\n\r\n scope.pointAvailable = function (point) {\r\n if (minuteMode) return picker.isMinuteAvailable(point.value);\r\n else if (secondMode) return picker.isSecondAvailable(point.value);\r\n else return picker.isHourAvailable(point.value);\r\n };\r\n\r\n var unWatcher = scope.$watch(function () {\r\n return element[0].querySelectorAll('div').length;\r\n }, function () {\r\n exec();\r\n unWatcher();\r\n });\r\n }\r\n };\r\n }]);\r\n return moduleName;\r\n }\r\n\r\n var isElectron = window && window.process && window.process.type;\r\n if (typeof define === 'function' && define.amd) {\r\n define(['moment'], ngMaterialDatePicker);\r\n } else if (typeof module !== 'undefined' && module && module.exports && (typeof require === 'function') && !isElectron) {\r\n module.exports = ngMaterialDatePicker(require('moment'));\r\n } else {\r\n ngMaterialDatePicker((typeof global !== 'undefined' ? global : window).moment);\r\n }\r\n})();\r\n"]} \ No newline at end of file diff --git a/index.html b/index.html index 5a31521..390e364 100644 --- a/index.html +++ b/index.html @@ -141,6 +141,17 @@

Datetime Pickers

+
+ + + + +
+
+
diff --git a/js/angular-material-datetimepicker.js b/js/angular-material-datetimepicker.js index 018ebb6..c5b7196 100644 --- a/js/angular-material-datetimepicker.js +++ b/js/angular-material-datetimepicker.js @@ -117,6 +117,7 @@ clickOutsideToClose: false, minuteSteps: 5, showIcon: false, + showClear: true, template: template, templateUrl: '', targetEvent: null, @@ -169,6 +170,7 @@ clickOutsideToClose: '=', minuteSteps: '=', showIcon: '=', + showClear: '=', templateUrl: '@', dayOfWeekLen: '=', hasBackdrop: '=' @@ -296,7 +298,7 @@ 'ng-click="openCalendarDiag($event)">' + '' + '', - clearButton = ''; + clearButton = scope.showClear === undefined || scope.showClear ? '' : ''; element.after($compile(calendarButton + clearButton)(scope)); scope.openCalendarDiag = function(e) {