diff --git a/bower.json b/bower.json index b154b85..d19b4e9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angularjs-datepicker", - "version": "2.1.2", + "version": "2.1.3", "description": "A datepicker directive for angularjs.", "authors": [ "Filippo Oretti ','
','","
","",'
','
','","
","
"]:['
','
','',a,"","
",'
',"{{month}} ",'',"","{{year}}","","","","
",'
','',b,"","
","
"]},f=function(a,b){return['
','",'
','',a,"",'',b,"","
","
"]},g=function(){return['
','
',"{{d}}","
","
"]},h=function(){return['
','',"{{px}}","","","{{item}}","",'',"{{nx}}","","
"]},i=function(a,b){var c=['
',"
"],d=e(a,b),i=f(a,b),j=g(),k=h(),l=function(a){c.splice(c.length-1,0,a)};return d.forEach(l),i.forEach(l),j.forEach(l),k.forEach(l),c.join("")},j=function(b,e,f,g,h){var j=function(j,k,l){var m,n,o=l.selector,p=a.element(o?k[0].querySelector("."+o):k[0].children[0]),q='',r='',s=l.buttonPrev||q,t=l.buttonNext||r,u=l.dateFormat,v=j.$eval(j.dateDisabledDates),w=new Date,x=!1,y=!1,z=f.DATETIME_FORMATS,A=864e5,B=i(s,t),C=function(){x||y||!m||j.hideCalendar()},D=function(){j.month=g("date")(new Date(j.dateMinLimit),"MMMM"),j.monthNumber=Number(g("date")(new Date(j.dateMinLimit),"MM")),j.day=Number(g("date")(new Date(j.dateMinLimit),"dd")),j.year=Number(g("date")(new Date(j.dateMinLimit),"yyyy"))},E=function(){j.month=g("date")(new Date(j.dateMaxLimit),"MMMM"),j.monthNumber=Number(g("date")(new Date(j.dateMaxLimit),"MM")),j.day=Number(g("date")(new Date(j.dateMaxLimit),"dd")),j.year=Number(g("date")(new Date(j.dateMaxLimit),"yyyy"))},F=function(){j.year=Number(j.year)-1},G=function(){j.year=Number(j.year)+1},H=function(){if(!j.isSelectableMinDate(j.year+"/"+j.monthNumber+"/"+j.day)||!j.isSelectableMaxDate(j.year+"/"+j.monthNumber+"/"+j.day))return!1;var a=new Date(j.year+"/"+j.monthNumber+"/"+j.day);l.dateFormat?p.val(g("date")(a,u)):p.val(a),p.triggerHandler("input"),p.triggerHandler("change")},I={add:function(a,b){var c;a.className.indexOf(b)>-1||(c=a.className.split(" "),c.push(b),a.className=c.join(" "))},remove:function(a,b){var c,d;if(-1!==a.className.indexOf(b)){for(d=a.className.split(" "),c=0;c=c;c+=1)j.days.push(c);if(0===h)j.prevMonthDays=[];else{for(e=h,f=1===Number(a)?12:a-1,c=1;c<=new Date(b,f,0).getDate();c+=1)k.push(c);j.prevMonthDays=k.slice(-e)}if(6>i){for(d=6-i,c=1;d>=c;c+=1)l.push(c);j.nextMonthDays=l}else j.nextMonthDays=[]},N=j.$watch("dateSet",function(a){a&&(w=new Date(g("date")(new Date(a),l.dateFormat)),j.month=g("date")(w,"MMMM"),j.monthNumber=Number(g("date")(w,"MM")),j.day=Number(g("date")(w,"dd")),j.year=Number(g("date")(w,"yyyy")),M(j.monthNumber,j.year),"true"!==j.dateSetHidden&&H())});j.nextMonth=function(){12===j.monthNumber?(j.monthNumber=1,G()):j.monthNumber+=1,j.dateMaxLimit&&(j.isSelectableMaxDate(j.year+"/"+j.monthNumber+"/"+j.days[0])||E()),j.month=g("date")(new Date(j.year,j.monthNumber-1),"MMMM"),M(j.monthNumber,j.year),j.day=void 0},j.willPrevMonthBeSelectable=function(){var a=j.monthNumber,b=j.year,c=g("date")(new Date(new Date(b+"/"+a+"/01").getTime()-A),"dd");return 1===a?(a=12,b-=1):a-=1,!j.dateMinLimit||j.isSelectableMinDate(b+"/"+a+"/"+c)},j.willNextMonthBeSelectable=function(){var a=j.monthNumber,b=j.year;return 12===a?(a=1,b+=1):a+=1,!j.dateMaxLimit||j.isSelectableMaxDate(b+"/"+a+"/01")},j.prevMonth=function(){1===j.monthNumber?(j.monthNumber=12,F()):j.monthNumber-=1,j.dateMinLimit&&(j.isSelectableMinDate(j.year+"/"+j.monthNumber+"/"+j.days[j.days.length-1])||D()),j.month=g("date")(new Date(j.year,j.monthNumber-1),"MMMM"),M(j.monthNumber,j.year),j.day=void 0},j.selectedMonthHandle=function(a){j.monthNumber=Number(g("date")(new Date(a+"/01/2000"),"MM")),M(j.monthNumber,j.year),H()},j.setNewYear=function(a){if(d||(j.day=void 0),j.dateMaxLimit&&j.yearNumber(a)&&!j.isSelectableMinYear(a))return;j.year=Number(a),M(j.monthNumber,j.year),j.paginateYears(a),j.showYearsPagination=!1},j.hideCalendar=function(){m.classList?m.classList.remove("_720kb-datepicker-open"):I.remove(m,"_720kb-datepicker-open")},j.setDatepickerDay=function(a){j.isSelectableDate(j.monthNumber,j.year,a)&&j.isSelectableMaxDate(j.year+"/"+j.monthNumber+"/"+a)&&j.isSelectableMinDate(j.year+"/"+j.monthNumber+"/"+a)&&(j.day=Number(a),H(),l.hasOwnProperty("dateRefocus")&&p[0].focus(),j.hideCalendar())},j.paginateYears=function(a){var b,c=[],e=10,f=10;for(j.paginationYears=[],d&&(e=50,f=50,j.dateMinLimit&&j.dateMaxLimit&&(a=new Date(j.dateMaxLimit).getFullYear(),e=a-new Date(j.dateMinLimit).getFullYear(),f=1)),b=e;b>0;b-=1)c.push(Number(a)-b);for(b=0;f>b;b+=1)c.push(Number(a)+b);"true"===j.dateTyper&&p.on("keyup blur",function(){if(p[0].value&&p[0].value.length&&p[0].value.length>0)try{w=new Date(p[0].value.toString()),w.getFullYear()&&!isNaN(w.getDay())&&!isNaN(w.getMonth())&&j.isSelectableDate(w)&&j.isSelectableMaxDate(w)&&j.isSelectableMinDate(w)&&j.$apply(function(){j.month=g("date")(w,"MMMM"),j.monthNumber=Number(g("date")(w,"MM")),j.day=Number(g("date")(w,"dd")),4===w.getFullYear().toString().length&&(j.year=Number(g("date")(w,"yyyy"))),M(j.monthNumber,j.year)})}catch(a){return a}}),j.dateMaxLimit&&c&&c.length&&!j.isSelectableMaxYear(Number(c[c.length-1])+1)?j.paginationYearsNextDisabled=!0:j.paginationYearsNextDisabled=!1,j.dateMinLimit&&c&&c.length&&!j.isSelectableMinYear(Number(c[0])-1)?j.paginationYearsPrevDisabled=!0:j.paginationYearsPrevDisabled=!1,j.paginationYears=c},j.isSelectableDate=function(a,b,c){var d=0;if(v&&v.length>0)for(d;d<=v.length;d+=1)if(new Date(v[d]).getTime()===new Date(a+"/"+c+"/"+b).getTime())return!1;return!0},j.isSelectableMinDate=function(a){return!(j.dateMinLimit&&new Date(j.dateMinLimit)&&new Date(a).getTime()new Date(j.dateMaxLimit).getTime())},j.isSelectableMaxYear=function(a){return!(j.dateMaxLimit&&a>new Date(j.dateMaxLimit).getFullYear())},j.isSelectableMinYear=function(a){return!(j.dateMinLimit&&a','
','","
","",'
','
','","
","
"]:['
','
','',a,"","
",'
',"{{month}} ",'',"","{{year}}","","","","
",'
','',b,"","
","
"]},f=function(a,b){return['
','",'
','',a,"",'',b,"","
","
"]},g=function(){return['
','
',"{{d}}","
","
"]},h=function(){return['"]},i=function(a,b){var c=['
',"
"],d=e(a,b),i=f(a,b),j=g(),k=h(),l=function(a){c.splice(c.length-1,0,a)};return d.forEach(l),i.forEach(l),j.forEach(l),k.forEach(l),c.join("")},j=function(b,e,f,g,h){var j=function(j,k,l){var m,n,o=l.selector,p=a.element(o?k[0].querySelector("."+o):k[0].children[0]),q='',r='',s=l.buttonPrev||q,t=l.buttonNext||r,u=l.dateFormat,v=j.$eval(j.dateDisabledDates),w=new Date,x=!1,y=!1,z=f.DATETIME_FORMATS,A=864e5,B=i(s,t),C=function(){x||y||!m||j.hideCalendar()},D=function(){j.month=g("date")(new Date(j.dateMinLimit),"MMMM"),j.monthNumber=Number(g("date")(new Date(j.dateMinLimit),"MM")),j.day=Number(g("date")(new Date(j.dateMinLimit),"dd")),j.year=Number(g("date")(new Date(j.dateMinLimit),"yyyy"))},E=function(){j.month=g("date")(new Date(j.dateMaxLimit),"MMMM"),j.monthNumber=Number(g("date")(new Date(j.dateMaxLimit),"MM")),j.day=Number(g("date")(new Date(j.dateMaxLimit),"dd")),j.year=Number(g("date")(new Date(j.dateMaxLimit),"yyyy"))},F=function(){j.year=Number(j.year)-1},G=function(){j.year=Number(j.year)+1},H=function(){if(!j.isSelectableMinDate(j.year+"/"+j.monthNumber+"/"+j.day)||!j.isSelectableMaxDate(j.year+"/"+j.monthNumber+"/"+j.day))return!1;var a=new Date(j.year+"/"+j.monthNumber+"/"+j.day);l.dateFormat?p.val(g("date")(a,u)):p.val(a),p.triggerHandler("input"),p.triggerHandler("change")},I={add:function(a,b){var c;a.className.indexOf(b)>-1||(c=a.className.split(" "),c.push(b),a.className=c.join(" "))},remove:function(a,b){var c,d;if(-1!==a.className.indexOf(b)){for(d=a.className.split(" "),c=0;c=c;c+=1)j.days.push(c);if(0===h)j.prevMonthDays=[];else{for(e=h,f=1===Number(a)?12:a-1,c=1;c<=new Date(b,f,0).getDate();c+=1)k.push(c);j.prevMonthDays=k.slice(-e)}if(6>i){for(d=6-i,c=1;d>=c;c+=1)l.push(c);j.nextMonthDays=l}else j.nextMonthDays=[]},N=j.$watch("dateSet",function(a){a&&(w=new Date(a),j.month=g("date")(w,"MMMM"),j.monthNumber=Number(g("date")(w,"MM")),j.day=Number(g("date")(w,"dd")),j.year=Number(g("date")(w,"yyyy")),M(j.monthNumber,j.year),"true"!==j.dateSetHidden&&H())});j.nextMonth=function(){12===j.monthNumber?(j.monthNumber=1,G()):j.monthNumber+=1,j.dateMaxLimit&&(j.isSelectableMaxDate(j.year+"/"+j.monthNumber+"/"+j.days[0])||E()),j.month=g("date")(new Date(j.year,j.monthNumber-1),"MMMM"),M(j.monthNumber,j.year),j.day=void 0},j.willPrevMonthBeSelectable=function(){var a=j.monthNumber,b=j.year,c=g("date")(new Date(new Date(b+"/"+a+"/01").getTime()-A),"dd");return 1===a?(a=12,b-=1):a-=1,!j.dateMinLimit||j.isSelectableMinDate(b+"/"+a+"/"+c)},j.willNextMonthBeSelectable=function(){var a=j.monthNumber,b=j.year;return 12===a?(a=1,b+=1):a+=1,!j.dateMaxLimit||j.isSelectableMaxDate(b+"/"+a+"/01")},j.prevMonth=function(){1===j.monthNumber?(j.monthNumber=12,F()):j.monthNumber-=1,j.dateMinLimit&&(j.isSelectableMinDate(j.year+"/"+j.monthNumber+"/"+j.days[j.days.length-1])||D()),j.month=g("date")(new Date(j.year,j.monthNumber-1),"MMMM"),M(j.monthNumber,j.year),j.day=void 0},j.selectedMonthHandle=function(a){j.monthNumber=Number(g("date")(new Date(a+"/01/2000"),"MM")),M(j.monthNumber,j.year),H()},j.setNewYear=function(a){if(d||(j.day=void 0),j.dateMaxLimit&&j.yearNumber(a)&&!j.isSelectableMinYear(a))return;j.year=Number(a),M(j.monthNumber,j.year),j.paginateYears(a),j.showYearsPagination=!1},j.hideCalendar=function(){m.classList?m.classList.remove("_720kb-datepicker-open"):I.remove(m,"_720kb-datepicker-open")},j.setDatepickerDay=function(a){j.isSelectableDate(j.monthNumber,j.year,a)&&j.isSelectableMaxDate(j.year+"/"+j.monthNumber+"/"+a)&&j.isSelectableMinDate(j.year+"/"+j.monthNumber+"/"+a)&&(j.day=Number(a),H(),l.hasOwnProperty("dateRefocus")&&p[0].focus(),j.hideCalendar())},j.paginateYears=function(a){var b,c=[],e=10,f=10;for(j.paginationYears=[],d&&(e=50,f=50,j.dateMinLimit&&j.dateMaxLimit&&(a=new Date(j.dateMaxLimit).getFullYear(),e=a-new Date(j.dateMinLimit).getFullYear(),f=1)),b=e;b>0;b-=1)c.push(Number(a)-b);for(b=0;f>b;b+=1)c.push(Number(a)+b);"true"===j.dateTyper&&p.on("keyup blur",function(){if(p[0].value&&p[0].value.length&&p[0].value.length>0)try{w=new Date(p[0].value.toString()),w.getFullYear()&&!isNaN(w.getDay())&&!isNaN(w.getMonth())&&j.isSelectableDate(w)&&j.isSelectableMaxDate(w)&&j.isSelectableMinDate(w)&&j.$apply(function(){j.month=g("date")(w,"MMMM"),j.monthNumber=Number(g("date")(w,"MM")),j.day=Number(g("date")(w,"dd")),4===w.getFullYear().toString().length&&(j.year=Number(g("date")(w,"yyyy"))),M(j.monthNumber,j.year)})}catch(a){return a}}),j.dateMaxLimit&&c&&c.length&&!j.isSelectableMaxYear(Number(c[c.length-1])+1)?j.paginationYearsNextDisabled=!0:j.paginationYearsNextDisabled=!1,j.dateMinLimit&&c&&c.length&&!j.isSelectableMinYear(Number(c[0])-1)?j.paginationYearsPrevDisabled=!0:j.paginationYearsPrevDisabled=!1,j.paginationYears=c},j.isSelectableDate=function(a,b,c){var d=0;if(v&&v.length>0)for(d;d<=v.length;d+=1)if(new Date(v[d]).getTime()===new Date(a+"/"+c+"/"+b).getTime())return!1;return!0},j.isSelectableMinDate=function(a){return!(j.dateMinLimit&&new Date(j.dateMinLimit)&&new Date(a).getTime()new Date(j.dateMaxLimit).getTime())},j.isSelectableMaxYear=function(a){return!(j.dateMaxLimit&&a>new Date(j.dateMaxLimit).getFullYear())},j.isSelectableMinYear=function(a){return!(j.dateMinLimit&&a