Component-Builder/admin/custom/uikit/js/components/datepicker.min.js

3 lines
37 KiB
JavaScript
Raw Normal View History

2016-01-30 20:28:43 +00:00
/*! UIkit 2.21.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
!function(t){var e;window.UIkit&&(e=t(UIkit)),"function"==typeof define&&define.amd&&define("uikit-datepicker",["uikit"],function(){return e||t(UIkit)})}(function(t){"use strict";var e,n,a=!1;return t.component("datepicker",{defaults:{mobile:!1,weekstart:1,i18n:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},format:"DD.MM.YYYY",offsettop:5,maxDate:!1,minDate:!1,pos:"auto",template:function(e,a){var s,i,r,o="";if(a.maxDate!==!1&&(s=isNaN(a.maxDate)?n(a.maxDate,a.format):n().add(a.maxDate,"days")),a.minDate!==!1&&(i=isNaN(a.minDate)?n(a.minDate,a.format):n().add(a.minDate-1,"days")),o+='<div class="uk-datepicker-nav">',o+='<a href="" class="uk-datepicker-previous"></a>',o+='<a href="" class="uk-datepicker-next"></a>',t.formSelect){var u,c,d,l,h=(new Date).getFullYear(),f=[];for(r=0;r<a.i18n.months.length;r++)r==e.month?f.push('<option value="'+r+'" selected>'+a.i18n.months[r]+"</option>"):f.push('<option value="'+r+'">'+a.i18n.months[r]+"</option>");for(u='<span class="uk-form-select">'+a.i18n.months[e.month]+'<select class="update-picker-month">'+f.join("")+"</select></span>",f=[],d=i?i.year():h-50,l=s?s.year():h+20,r=d;l>=r;r++)r==e.year?f.push('<option value="'+r+'" selected>'+r+"</option>"):f.push('<option value="'+r+'">'+r+"</option>");c='<span class="uk-form-select">'+e.year+'<select class="update-picker-year">'+f.join("")+"</select></span>",o+='<div class="uk-datepicker-heading">'+u+" "+c+"</div>"}else o+='<div class="uk-datepicker-heading">'+a.i18n.months[e.month]+" "+e.year+"</div>";for(o+="</div>",o+='<table class="uk-datepicker-table">',o+="<thead>",r=0;r<e.weekdays.length;r++)e.weekdays[r]&&(o+="<th>"+e.weekdays[r]+"</th>");for(o+="</thead>",o+="<tbody>",r=0;r<e.days.length;r++)if(e.days[r]&&e.days[r].length){o+="<tr>";for(var m=0;m<e.days[r].length;m++)if(e.days[r][m]){var _=e.days[r][m],p=[];_.inmonth||p.push("uk-datepicker-table-muted"),_.selected&&p.push("uk-active"),s&&_.day>s&&p.push("uk-datepicker-date-disabled uk-datepicker-table-muted"),i&&i>_.day&&p.push("uk-datepicker-date-disabled uk-datepicker-table-muted"),o+='<td><a href="" class="'+p.join(" ")+'" data-date="'+_.day.format()+'">'+_.day.format("D")+"</a></td>"}o+="</tr>"}return o+="</tbody>",o+="</table>"}},boot:function(){t.$win.on("resize orientationchange",function(){a&&a.hide()}),t.$html.on("focus.datepicker.uikit","[data-uk-datepicker]",function(e){var n=t.$(this);if(!n.data("datepicker")){e.preventDefault();{t.datepicker(n,t.Utils.options(n.attr("data-uk-datepicker")))}n.trigger("focus")}}),t.$html.on("click.datepicker.uikit",function(n){var s=t.$(n.target);!a||s[0]==e[0]||s.data("datepicker")||s.parents(".uk-datepicker:first").length||a.hide()})},init:function(){if(!t.support.touch||"date"!=this.element.attr("type")||this.options.mobile){var s=this;this.current=this.element.val()?n(this.element.val(),this.options.format):n(),this.on("click focus",function(){a!==s&&s.pick(this.value?this.value:s.options.minDate?s.options.minDate:"")}).on("change",function(){s.element.val()&&!n(s.element.val(),s.options.format).isValid()&&s.element.val(n().format(s.options.format))}),e||(e=t.$('<div class="uk-dropdown uk-datepicker"></div>'),e.on("click",".uk-datepicker-next, .uk-datepicker-previous, [data-date]",function(s){s.stopPropagation(),s.preventDefault();var i=t.$(this);return i.hasClass("uk-datepicker-date-disabled")?!1:(i.is("[data-date]")?(a.element.val(n(i.data("date")).format(a.options.format)).trigger("change"),e.hide(),a=!1):a.add(1*(i.hasClass("uk-datepicker-next")?1:-1),"months"),void 0)}),e.on("change",".update-picker-month, .update-picker-year",function(){var e=t.$(this);a[e.is(".update-picker-year")?"setYear":"setMonth"](Number(e.val()))}),e.appendTo("body"))}},pick:function(s){var i=this.element.offset(),r={left:i.left,right:""};this.current=s?n(s,this.options.format):n(),this.initdate=this.current.format("YYYY-MM-DD"),this.update(),"right"==t.langdirection&&(r.right=window.innerWidth-(r.left+this.element.outerWi
},hasAlignedHourOffset:function(t){return t=t?ke(t).zone():0,(this.zone()-t)%60===0},daysInMonth:function(){return T(this.year(),this.month())},dayOfYear:function(t){var e=Me((ke(this).startOf("day")-ke(this).startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")},quarter:function(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)},weekYear:function(t){var e=oe(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==t?e:this.add(t-e,"y")},isoWeekYear:function(t){var e=oe(this,1,4).year;return null==t?e:this.add(t-e,"y")},week:function(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")},isoWeek:function(t){var e=oe(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")},weekday:function(t){var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")},isoWeekday:function(t){return null==t?this.day()||7:this.day(this.day()%7?t:t-7)},isoWeeksInYear:function(){return O(this.year(),1,4)},weeksInYear:function(){var t=this.localeData()._week;return O(this.year(),t.dow,t.doy)},get:function(t){return t=w(t),this[t]()},set:function(t,e){return t=w(t),"function"==typeof this[t]&&this[t](e),this},locale:function(e){var n;return e===t?this._locale._abbr:(n=ke.localeData(e),null!=n&&(this._locale=n),this)},lang:i("moment().lang() is deprecated. Use moment().localeData() instead.",function(e){return e===t?this.localeData():this.locale(e)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),ke.fn.millisecond=ke.fn.milliseconds=me("Milliseconds",!1),ke.fn.second=ke.fn.seconds=me("Seconds",!1),ke.fn.minute=ke.fn.minutes=me("Minutes",!1),ke.fn.hour=ke.fn.hours=me("Hours",!0),ke.fn.date=me("Date",!0),ke.fn.dates=i("dates accessor is deprecated. Use date instead.",me("Date",!0)),ke.fn.year=me("FullYear",!0),ke.fn.years=i("years accessor is deprecated. Use year instead.",me("FullYear",!0)),ke.fn.days=ke.fn.day,ke.fn.months=ke.fn.month,ke.fn.weeks=ke.fn.week,ke.fn.isoWeeks=ke.fn.isoWeek,ke.fn.quarters=ke.fn.quarter,ke.fn.toJSON=ke.fn.toISOString,h(ke.duration.fn=l.prototype,{_bubble:function(){var t,e,n,a=this._milliseconds,s=this._days,i=this._months,r=this._data,o=0;r.milliseconds=a%1e3,t=m(a/1e3),r.seconds=t%60,e=m(t/60),r.minutes=e%60,n=m(e/60),r.hours=n%24,s+=m(n/24),o=m(_e(s)),s-=m(pe(o)),i+=m(s/30),s%=30,o+=m(i/12),i%=12,r.days=s,r.months=i,r.years=o},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return m(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12)},humanize:function(t){var e=re(this,!t,this.localeData());return t&&(e=this.localeData().pastFuture(+this,e)),this.localeData().postformat(e)},add:function(t,e){var n=ke.duration(t,e);return this._milliseconds+=n._milliseconds,this._days+=n._days,this._months+=n._months,this._bubble(),this},subtract:function(t,e){var n=ke.duration(t,e);return this._milliseconds-=n._milliseconds,this._days-=n._days,this._months-=n._months,this._bubble(),this},get:function(t){return t=w(t),this[t.toLowerCase()+"s"]()},as:function(t){var e,n;if(t=w(t),"month"===t||"year"===t)return e=this._days+this._milliseconds/864e5,n=this._months+12*_e(e),"month"===t?n:n/12;switch(e=this._days+pe(this._months/12),t){case"week":return e/7+this._milliseconds/6048e5;case"day":return e+this._milliseconds/864e5;case"hour":return 24*e+this._milliseconds/36e5;case"minute":return 24*e*60+this._milliseconds/6e4;case"second":return 24*e*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*e*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+t