diff --git a/bower.json b/bower.json index a6ec839..e5c9d61 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bootstrap-ui-datetime-picker", - "version": "1.2.0", + "version": "1.2.1", "homepage": "https://github.com/Gillardo/bootstrap-ui-datetime-picker", "authors": [ "Gillardo " diff --git a/datetime-picker.js b/datetime-picker.js index 78a81fa..4f694b2 100644 --- a/datetime-picker.js +++ b/datetime-picker.js @@ -401,7 +401,7 @@ } $popup.remove(); - element.unbind('keydown', keydown); + element.unbind('keydown', inputKeydownBind); $document.unbind('click', documentClickBind); }); } diff --git a/dist/datetime-picker.js b/dist/datetime-picker.js index e56f0b3..829cb67 100644 --- a/dist/datetime-picker.js +++ b/dist/datetime-picker.js @@ -1,5 +1,5 @@ // https://github.com/Gillardo/bootstrap-ui-datetime-picker -// Version: 1.2.0 +// Version: 1.2.1 // Released: 2015-08-26 angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position']) .constant('uiDatetimePickerConfig', { @@ -404,7 +404,7 @@ angular.module('ui.bootstrap.datetimepicker', ['ui.bootstrap.dateparser', 'ui.bo } $popup.remove(); - element.unbind('keydown', keydown); + element.unbind('keydown', inputKeydownBind); $document.unbind('click', documentClickBind); }); } diff --git a/dist/datetime-picker.min.js b/dist/datetime-picker.min.js index cf2386e..d57a915 100644 --- a/dist/datetime-picker.min.js +++ b/dist/datetime-picker.min.js @@ -1,4 +1,4 @@ // https://github.com/Gillardo/bootstrap-ui-datetime-picker -// Version: 1.2.0 +// Version: 1.2.1 // Released: 2015-08-26 -angular.module("ui.bootstrap.datetimepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("uiDatetimePickerConfig",{dateFormat:"yyyy-MM-dd HH:mm",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},enableDate:!0,enableTime:!0,todayText:"Today",nowText:"Now",clearText:"Clear",closeText:"Done",dateText:"Date",timeText:"Time",closeOnDateSelection:!0,appendToBody:!1,showButtonBar:!0}).directive("datetimePicker",["$compile","$parse","$document","$timeout","$position","dateFilter","dateParser","uiDatetimePickerConfig","$rootScope",function(a,b,c,d,e,f,g,h,i){return{restrict:"A",require:"ngModel",scope:{isOpen:"=?",enableDate:"=?",enableTime:"=?",todayText:"@",nowText:"@",dateText:"@",timeText:"@",clearText:"@",closeText:"@",dateDisabled:"&"},link:function(j,k,l,m){function n(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function o(a){if(angular.isNumber(a)&&(a=new Date(a)),a){if(angular.isDate(a)&&!isNaN(a))return a;if(angular.isString(a)){var b=g.parse(a,q,j.date);return isNaN(b)?void 0:b}return void 0}return null}function p(a,b){var c=a||b;if(!l.ngRequired&&!c)return!0;if(angular.isNumber(c)&&(c=new Date(c)),c){if(angular.isDate(c)&&!isNaN(c))return!0;if(angular.isString(c)){var d=g.parse(c,q);return!isNaN(d)}return!1}return!0}var q=h.dateFormat,r=angular.isDefined(l.closeOnDateSelection)?j.$parent.$eval(l.closeOnDateSelection):h.closeOnDateSelection,s=angular.isDefined(l.datepickerAppendToBody)?j.$parent.$eval(l.datepickerAppendToBody):h.appendToBody;j.showButtonBar=angular.isDefined(l.showButtonBar)?j.$parent.$eval(l.showButtonBar):h.showButtonBar,j.enableDate=angular.isDefined(j.enableDate)?j.enableDate:h.enableDate,j.enableTime=angular.isDefined(j.enableTime)?j.enableTime:h.enableTime,j.showPicker=j.enableDate?"date":"time",j.getText=function(a){return j[a+"Text"]||h[a+"Text"]};var t=!1;h.html5Types[l.type]?(q=h.html5Types[l.type],t=!0):(q=l.datepickerPopup||h.dateFormat,l.$observe("datetimePicker",function(a){var b=a||h.dateFormat;if(b!==q&&(q=b,m.$modelValue=null,!q))throw new Error("datetimePicker must have a date format specified.")}));var u=angular.element('
');u.attr({"ng-model":"date","ng-change":"dateSelection(date)"});var v=angular.element(u.children()[0]);if(t&&"month"===l.type&&(v.attr("datepicker-mode",'"month"'),v.attr("min-mode","month")),l.datepickerOptions){var w=j.$parent.$eval(l.datepickerOptions);w&&w.initDate&&(j.initDate=w.initDate,v.attr("init-date","initDate"),delete w.initDate),angular.forEach(w,function(a,b){v.attr(n(b),a)})}var x=angular.element(u.children()[1]);if(l.timepickerOptions){var w=j.$parent.$eval(l.timepickerOptions);angular.forEach(w,function(a,b){x.attr(n(b),a)})}angular.isDefined(l.datepickerMode)||(l.datepickerMode="day"),j.watchData={},angular.forEach(["minMode","maxMode","minDate","maxDate","datepickerMode","initDate","shortcutPropagation"],function(a){if(l[a]){var c=b(l[a]);if(j.$parent.$watch(c,function(b){j.watchData[a]=b}),v.attr(n(a),"watchData."+a),"datepickerMode"===a){var d=c.assign;j.$watch("watchData."+a,function(a,b){angular.isFunction(d)&&a!==b&&d(j.$parent,a)})}}}),l.dateDisabled&&v.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),t?m.$formatters.push(function(a){return j.date=a,a}):(m.$$parserName="datetime",m.$validators.datetime=p,m.$parsers.unshift(o),m.$formatters.push(function(a){return j.date=a,m.$isEmpty(a)?a:f(a,q)})),j.dateSelection=function(a){if(j.enableDate&&j.enableTime&&"time"===j.showPicker&&(j.date&&null!==j.date||a||null!=a)&&a&&null!=a){var b=new Date(j.date);b.setHours(a.getHours()),b.setMinutes(a.getMinutes()),b.setSeconds(a.getSeconds()),b.setMilliseconds(a.getMilliseconds()),a=b}angular.isDefined(a)&&(j.date=a);var b=j.date?f(j.date,q):null;k.val(b),m.$setViewValue(b),null===a?j.close():r&&"time"!=j.showPicker&&(j.enableTime?d(function(){j.showPicker="time"},0):j.close())},m.$viewChangeListeners.push(function(){j.date=g.parse(m.$viewValue,q,j.date)});var y=function(a){j.isOpen&&a.target!==k[0]&&j.$apply(function(){j.close()})},z=function(a){27===a.which&&j.isOpen?(a.preventDefault(),a.stopPropagation(),j.$apply(function(){j.close()}),k[0].focus()):40!==a.which||j.isOpen||(a.preventDefault(),a.stopPropagation(),j.$apply(function(){j.isOpen=!0}))};k.bind("keydown",z),j.keydown=function(a){27===a.which&&(j.close(),k[0].focus())},j.$watch("isOpen",function(a){if(j.dropdownStyle={display:a?"block":"none"},a){var b=s?e.offset(k):e.position(k);j.dropdownStyle.top=s?b.top+k.prop("offsetHeight")+"px":void 0,j.dropdownStyle.left=b.left+"px",d(function(){j.$broadcast("datepicker.focus"),c.bind("click",y)},0,!1)}else c.unbind("click",y)}),j.isDisabled=function(a){return("today"===a||"now"===a)&&(a=new Date),l.dateDisabled?j.dateDisabled({date:a,mode:j.watchData.datepickerMode}):!1},j.select=function(a){if("today"===a||"now"==a){var b=new Date;angular.isDate(j.date)?(a=new Date(j.date),a.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),a.setHours(b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds())):a=b}j.dateSelection(a)},j.close=function(){j.isOpen=!1,j.enableDate&&j.enableTime&&(j.showPicker="date"),k[0].focus()},j.changePicker=function(a,b){a.preventDefault(),a.stopPropagation(),j.showPicker=b};var A=a(u)(j);u.remove(),s?c.find("body").append(A):k.after(A),j.$on("$destroy",function(){j.isOpen===!0&&(i.$$phase||j.$apply(function(){j.close()})),A.remove(),k.unbind("keydown",keydown),c.unbind("click",y)})}}}]).directive("datePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/date-picker.html"}}).directive("timePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/time-picker.html"}}),angular.module("ui.bootstrap.datetimepicker").run(["$templateCache",function(a){"use strict";a.put("template/date-picker.html",''),a.put("template/time-picker.html",'')}]); \ No newline at end of file +angular.module("ui.bootstrap.datetimepicker",["ui.bootstrap.dateparser","ui.bootstrap.position"]).constant("uiDatetimePickerConfig",{dateFormat:"yyyy-MM-dd HH:mm",html5Types:{date:"yyyy-MM-dd","datetime-local":"yyyy-MM-ddTHH:mm:ss.sss",month:"yyyy-MM"},enableDate:!0,enableTime:!0,todayText:"Today",nowText:"Now",clearText:"Clear",closeText:"Done",dateText:"Date",timeText:"Time",closeOnDateSelection:!0,appendToBody:!1,showButtonBar:!0}).directive("datetimePicker",["$compile","$parse","$document","$timeout","$position","dateFilter","dateParser","uiDatetimePickerConfig","$rootScope",function(a,b,c,d,e,f,g,h,i){return{restrict:"A",require:"ngModel",scope:{isOpen:"=?",enableDate:"=?",enableTime:"=?",todayText:"@",nowText:"@",dateText:"@",timeText:"@",clearText:"@",closeText:"@",dateDisabled:"&"},link:function(j,k,l,m){function n(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}function o(a){if(angular.isNumber(a)&&(a=new Date(a)),a){if(angular.isDate(a)&&!isNaN(a))return a;if(angular.isString(a)){var b=g.parse(a,q,j.date);return isNaN(b)?void 0:b}return void 0}return null}function p(a,b){var c=a||b;if(!l.ngRequired&&!c)return!0;if(angular.isNumber(c)&&(c=new Date(c)),c){if(angular.isDate(c)&&!isNaN(c))return!0;if(angular.isString(c)){var d=g.parse(c,q);return!isNaN(d)}return!1}return!0}var q=h.dateFormat,r=angular.isDefined(l.closeOnDateSelection)?j.$parent.$eval(l.closeOnDateSelection):h.closeOnDateSelection,s=angular.isDefined(l.datepickerAppendToBody)?j.$parent.$eval(l.datepickerAppendToBody):h.appendToBody;j.showButtonBar=angular.isDefined(l.showButtonBar)?j.$parent.$eval(l.showButtonBar):h.showButtonBar,j.enableDate=angular.isDefined(j.enableDate)?j.enableDate:h.enableDate,j.enableTime=angular.isDefined(j.enableTime)?j.enableTime:h.enableTime,j.showPicker=j.enableDate?"date":"time",j.getText=function(a){return j[a+"Text"]||h[a+"Text"]};var t=!1;h.html5Types[l.type]?(q=h.html5Types[l.type],t=!0):(q=l.datepickerPopup||h.dateFormat,l.$observe("datetimePicker",function(a){var b=a||h.dateFormat;if(b!==q&&(q=b,m.$modelValue=null,!q))throw new Error("datetimePicker must have a date format specified.")}));var u=angular.element('
');u.attr({"ng-model":"date","ng-change":"dateSelection(date)"});var v=angular.element(u.children()[0]);if(t&&"month"===l.type&&(v.attr("datepicker-mode",'"month"'),v.attr("min-mode","month")),l.datepickerOptions){var w=j.$parent.$eval(l.datepickerOptions);w&&w.initDate&&(j.initDate=w.initDate,v.attr("init-date","initDate"),delete w.initDate),angular.forEach(w,function(a,b){v.attr(n(b),a)})}var x=angular.element(u.children()[1]);if(l.timepickerOptions){var w=j.$parent.$eval(l.timepickerOptions);angular.forEach(w,function(a,b){x.attr(n(b),a)})}angular.isDefined(l.datepickerMode)||(l.datepickerMode="day"),j.watchData={},angular.forEach(["minMode","maxMode","minDate","maxDate","datepickerMode","initDate","shortcutPropagation"],function(a){if(l[a]){var c=b(l[a]);if(j.$parent.$watch(c,function(b){j.watchData[a]=b}),v.attr(n(a),"watchData."+a),"datepickerMode"===a){var d=c.assign;j.$watch("watchData."+a,function(a,b){angular.isFunction(d)&&a!==b&&d(j.$parent,a)})}}}),l.dateDisabled&&v.attr("date-disabled","dateDisabled({ date: date, mode: mode })"),t?m.$formatters.push(function(a){return j.date=a,a}):(m.$$parserName="datetime",m.$validators.datetime=p,m.$parsers.unshift(o),m.$formatters.push(function(a){return j.date=a,m.$isEmpty(a)?a:f(a,q)})),j.dateSelection=function(a){if(j.enableDate&&j.enableTime&&"time"===j.showPicker&&(j.date&&null!==j.date||a||null!=a)&&a&&null!=a){var b=new Date(j.date);b.setHours(a.getHours()),b.setMinutes(a.getMinutes()),b.setSeconds(a.getSeconds()),b.setMilliseconds(a.getMilliseconds()),a=b}angular.isDefined(a)&&(j.date=a);var b=j.date?f(j.date,q):null;k.val(b),m.$setViewValue(b),null===a?j.close():r&&"time"!=j.showPicker&&(j.enableTime?d(function(){j.showPicker="time"},0):j.close())},m.$viewChangeListeners.push(function(){j.date=g.parse(m.$viewValue,q,j.date)});var y=function(a){j.isOpen&&a.target!==k[0]&&j.$apply(function(){j.close()})},z=function(a){27===a.which&&j.isOpen?(a.preventDefault(),a.stopPropagation(),j.$apply(function(){j.close()}),k[0].focus()):40!==a.which||j.isOpen||(a.preventDefault(),a.stopPropagation(),j.$apply(function(){j.isOpen=!0}))};k.bind("keydown",z),j.keydown=function(a){27===a.which&&(j.close(),k[0].focus())},j.$watch("isOpen",function(a){if(j.dropdownStyle={display:a?"block":"none"},a){var b=s?e.offset(k):e.position(k);j.dropdownStyle.top=s?b.top+k.prop("offsetHeight")+"px":void 0,j.dropdownStyle.left=b.left+"px",d(function(){j.$broadcast("datepicker.focus"),c.bind("click",y)},0,!1)}else c.unbind("click",y)}),j.isDisabled=function(a){return("today"===a||"now"===a)&&(a=new Date),l.dateDisabled?j.dateDisabled({date:a,mode:j.watchData.datepickerMode}):!1},j.select=function(a){if("today"===a||"now"==a){var b=new Date;angular.isDate(j.date)?(a=new Date(j.date),a.setFullYear(b.getFullYear(),b.getMonth(),b.getDate()),a.setHours(b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds())):a=b}j.dateSelection(a)},j.close=function(){j.isOpen=!1,j.enableDate&&j.enableTime&&(j.showPicker="date"),k[0].focus()},j.changePicker=function(a,b){a.preventDefault(),a.stopPropagation(),j.showPicker=b};var A=a(u)(j);u.remove(),s?c.find("body").append(A):k.after(A),j.$on("$destroy",function(){j.isOpen===!0&&(i.$$phase||j.$apply(function(){j.close()})),A.remove(),k.unbind("keydown",z),c.unbind("click",y)})}}}]).directive("datePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/date-picker.html"}}).directive("timePickerWrap",function(){return{restrict:"EA",replace:!0,transclude:!0,templateUrl:"template/time-picker.html"}}),angular.module("ui.bootstrap.datetimepicker").run(["$templateCache",function(a){"use strict";a.put("template/date-picker.html",''),a.put("template/time-picker.html",'')}]); \ No newline at end of file diff --git a/package.json b/package.json index 184aa2d..982a8b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "bootstrap-ui-datetime-picker", "url": "https://github.com/Gillardo/bootstrap-ui-datetime-picker", - "version": "1.2.0", + "version": "1.2.1", "devDependencies": { "grunt": "^0.4.5", "grunt-angular-templates": "^0.5.7",