UNPKG

@progress/kendo-ui

Version:

This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.

1 lines 26 kB
module.exports=function(t){function e(n){if(i[n])return i[n].exports;var a=i[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,e),a.loaded=!0,a.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}({0:function(t,e,i){t.exports=i(1469)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},1049:function(t,e){t.exports=require("./kendo.popup")},1186:function(t,e){t.exports=require("./kendo.dateinput")},1469:function(t,e,i){var n,a,s;!function(o,define){a=[i(1049),i(1186)],n=o,s="function"==typeof n?n.apply(e,a):n,!(void 0!==s&&(t.exports=s))}(function(){return function(t,e){function i(){var t=new st,e=new st(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0),i=new st(t.getFullYear(),t.getMonth(),t.getDate(),12,0,0);return-1*(e.getTimezoneOffset()-i.getTimezoneOffset())}function n(t){return 60*t.getHours()*z+t.getMinutes()*z+1e3*t.getSeconds()+t.getMilliseconds()}function a(t){var e=new Date(2100,0,1);return e.setMinutes(-t),e}function s(t,e,i){var a,s=n(e),o=n(i);return!t||s==o||(a=n(t),s>a&&(a+=G),o<s&&(o+=G),a>=s&&a<=o)}function o(t){var e=t.parseFormats;t.format=M(t.format||x.getCulture(t.culture).calendars.standard.patterns.t),e=it(e)?e:[e],e.splice(0,0,t.format),t.parseFormats=e}function l(t){t.preventDefault()}function r(t,e){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function u(t,e){var i,n=e.calendar;return"string"==typeof t&&(i=n.patterns[t]?n.patterns[t]:t),i||(i=n.patterns.d),i}function c(t,e){var i=t[t.length-1];i&&"LITERAL"===i.type?i.pattern+=e:t.push({type:lt,pattern:e})}function d(t){return"h"===t||"K"===t}function p(t){var e;return t<=3?e="abbreviated":4===t?e="wide":5===t?e="narrow":6===t&&(e="short"),e}function h(t,e,i){return i=i||0,t.indexOf(e,i)===i}function f(t,e){var i=!1;return t.indexOf(e)!==-1&&(i=!0),i}function m(t){for(var e,i,n,a,s,o,l,r=x.culture(),f=u(t,r),m=[],_=ot.lastIndex=0,g=ot.exec(f);g;)l=g[0],_<g.index&&c(m,f.substring(_,g.index)),h(l,'"')||h(l,"'")?c(m,l):(e=l[0],i=ht[e],n={type:i,pattern:l},"hour"===i&&(n.hour12=d(l)),a=ft[i],a&&(s="number"==typeof a.minLength?a.minLength:a.minLength[e],o=l.length,o>=s&&(n.names={type:a.type,nameType:p(o),standAlone:a.standAlone===e})),m.push(n)),_=ot.lastIndex,g=ot.exec(f);return _<f.length&&c(m,f.substring(_)),m}function _(t,e){for(var i=t+"";i.length<(e||2);)i="0"+i;return i}function g(t,e){return Math.max(Math.round(t/e),0)}function v(t){return t.length&&t[0].getBoundingClientRect().height}function w(t,e){function i(t,e){return{start:t,length:e,end:t+e}}function n(t,i){return!1===e||i.start<t.end&&t.start<i.end?Math.min(t.start,Math.max(i.start,t.end-i.length)):(t.start+t.end-i.length)/2}function a(t,e){return{x:t,y:e,translate:function(i,n){return a(t+i,e+n)}}}function s(t,e){for(;t;)e=e.translate(t.offsetLeft,t.offsetTop),t=t.offsetParent;return e}for(var o,l=s(t,a(0,0)),r=a(t.offsetWidth,t.offsetHeight),u=t.parentNode;u instanceof HTMLElement;)o=s(u,a(u.clientLeft,u.clientTop)),u.scrollLeft=n(i(l.x-o.x,r.x),i(u.scrollLeft,u.clientWidth)),u.scrollTop=n(i(l.y-o.y,r.y),i(u.scrollTop,u.clientHeight)),l=l.translate(-u.scrollLeft,-u.scrollTop),u=u.parentNode}var k,y,x=window.kendo,b=x.keys,T=x.parseDate,S=x._activeElement,M=x._extractFormat,D=x.support,V=D.browser,C=x.ui,L=C.Widget,H="open",I="close",R="change",A=".kendoTimePicker",P="click"+A,F="k-state-default",q="disabled",E="readonly",O="li",W="<span></span>",N="k-state-focused",B="k-state-hover",Y="mouseenter"+A+" mouseleave"+A,K="mousedown"+A,z=6e4,G=864e5,j="k-state-selected",Q="k-state-disabled",U="aria-selected",X="aria-expanded",Z="aria-hidden",J="aria-disabled",$="aria-readonly",tt="aria-activedescendant",et="id",it=Array.isArray,nt=t.extend,at=t.proxy,st=Date,ot=/d{1,2}|E{1,6}|e{1,6}|c{3,6}|c{1}|M{1,5}|L{1,5}|y{1,4}|H{1,2}|h{1,2}|k{1,2}|K{1,2}|m{1,2}|a{1,5}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|x{1,5}|X{1,5}|G{1,5}|q{1,5}|Q{1,5}|"[^"]*"|'[^']*'/g,lt="literal",rt="month",ut="hour",ct="zone",dt="weekday",pt="quarter",ht={G:"era",y:"year",q:pt,Q:pt,M:rt,L:rt,d:"day",E:dt,c:dt,e:dt,h:ut,H:ut,k:ut,K:ut,m:"minute",s:"second",a:"dayperiod",x:ct,X:ct,z:ct,Z:ct},ft={month:{type:"months",minLength:3,standAlone:"L"},quarter:{type:"quarters",minLength:3,standAlone:"q"},weekday:{type:"days",minLength:{E:0,c:3,e:3},standAlone:"c"},dayperiod:{type:"dayPeriods",minLength:0},era:{type:"eras",minLength:0}},mt=new st,_t='<div tabindex="0" class="k-timeselector"><div class="k-time-header"><span class="k-title"></span><button class="k-button k-flat k-time-now" title="Select now" aria-label="Select now">#=messages.now#</button></div><div class="k-time-list-container"><span class="k-time-highlight"></span></div></div>',gt='<div class="k-time-footer k-action-buttons"><button class="k-button k-time-cancel" title="Cancel changes" aria-label="Cancel changes">#=messages.cancel#</button><button class="k-time-accept k-button k-primary" title="Set time" aria-label="Set time">#=messages.set#</button></div>',vt='<span class="k-time-highlight"></span>';mt=new Date(mt.getFullYear(),mt.getMonth(),mt.getDate(),0,0,0),k=function(t){var e=this,i=t.id;e.options=t,e._dates=[],e._createList(t.timeView&&"scroll"===t.timeView.list),i&&(e._timeViewID=i+"_timeview",e._optionID=i+"_option_selected",e.ul.attr(et,e._timeViewID)),e._heightHandler=at(e._height,e),e._ariaLabel(),e._popup()},k.prototype={_createList:function(t){t?this._createScrollList():this._createClassicRenderingList()},_createScrollList:function(){this.list=t(x.template(_t)(this.options)).on(K,l),this.options.omitPopup||this.list.append(x.template(gt)(this.options)),this.ul=this.list.find(".k-time-list-container"),this.list.on("click"+A,".k-time-header button.k-time-now",at(this._nowClickHandler,this)),this.list.on("click"+A,".k-time-footer button.k-time-cancel",at(this._cancelClickHandler,this)),this.list.on("click"+A,".k-time-footer button.k-time-accept",at(this._setClickHandler,this)),this.list.on("mouseover"+A,".k-time-list-wrapper",at(this._mouseOverHandler,this)),this.list.on("keydown"+A,at(this._scrollerKeyDownHandler,this))},_ariaLabel:function(){var e,i=this,n=t("#"+i.options.id),a=i.ul,s=n.attr("id"),o=t("label[for='"+s+"']"),l=n.attr("aria-label"),r=n.attr("aria-labelledby");l?a.attr("aria-label",l):r?a.attr("aria-labelledby",r):o.length&&(e=o.attr("id"),e?a.attr("aria-labelledby",e):(e=x.guid(),o.attr("id",e),a.attr("aria-labelledby",e)))},_scrollerKeyDownHandler:function(e){var i=this,n=e.keyCode,a=t(e.currentTarget).find(".k-time-list-wrapper.k-state-focused"),s=i.list.find(".k-time-list-wrapper"),o=s.length,l=s.index(a),r=x.support.isRtl(i.wrapper),u=v(a.find(".k-item:visible").eq(0)),c=a.find(".k-time-container.k-content.k-scrollable");a.length&&(n==b.RIGHT&&!r||n==b.LEFT&&r?l+1<o&&i._focusList(s.eq(l+1)):n==b.LEFT&&!r||n==b.RIGHT&&r?l-1>=0&&i._focusList(s.eq(l-1)):n==b.UP?(c.scrollTop(c.scrollTop()-u),e.preventDefault()):n==b.DOWN?(c.scrollTop(c.scrollTop()+u),e.preventDefault()):n===b.ENTER?i._setClickHandler():n===b.ESC&&i._cancelClickHandler())},_mouseOverHandler:function(e){this._focusList(t(e.currentTarget))},_focusList:function(t){this.list.find(".k-time-list-wrapper").removeClass(N),t.addClass(N),this.list.trigger("focus"),this._scrollTop=t.find(".k-scrollable").scrollTop()},_createClassicRenderingList:function(){var e=this;e.ul=t('<ul tabindex="-1" role="listbox" aria-hidden="true" unselectable="on" class="k-list k-reset"/>').css({overflow:D.kineticScrollNeeded?"":"auto"}).on(P,O,at(e._click,e)).on("mouseenter"+A,O,function(){t(this).addClass(B)}).on("mouseleave"+A,O,function(){t(this).removeClass(B)}),e.list=t("<div class='k-list-container k-list-scroller' unselectable='on'/>").append(e.ul).on(K,l),e.template=x.template('<li tabindex="-1" role="option" class="k-item" unselectable="on">#=data#</li>',{useWithBlock:!1})},current:function(i){var n=this,a=n.options.active;return i===e?n._current:(n._current&&(n._current.removeClass(j),n._current&&n._current.length&&(n._current[0].removeAttribute(et),n._current[0].removeAttribute(U))),i&&(i=t(i).addClass(j).attr(et,n._optionID).attr(U,!0),n.scroll(i[0])),n._current=i,a&&a(i),e)},_updateTitle:function(){this.list.find(".k-time-header > .k-title").html(x.toString(this._value,this.options.format,this.options.culture))},applyValue:function(t){var e,i,n,a,s,o,l,r,u,c;t&&(e=f(this.options.format.toLowerCase(),"t"),i=t.getHours(),n=t.getMinutes(),a=t.getSeconds(),o=x.attr("index"),l=this.ul.find("["+o+'="1"]'),r=this.ul.find("["+o+'="2"]'),u=this.ul.find("["+o+'="3"]'),c=this.ul.find("["+o+'="4"]'),e&&(i>=12?(s="PM",i>12&&(i-=12)):(s="AM",0===i&&(i=12))),this._internalScroll=!0,l.length&&this._scrollListToPosition(l,i),r.length&&this._scrollListToPosition(r,n),u.length&&this._scrollListToPosition(u,a),c.length&&this._scrollListToPosition(c,s),this._internalScroll=!1)},_scrollListToPosition:function(t,e){var i=t.find('.k-item[data-value="'+_(e)+'"]'),n=v(i);t.scrollTop(t.find(".k-item:visible").index(i)*n)},close:function(){this.popup.close()},destroy:function(){var t=this;t.ul.off(A),t.list.off(A),this.popup&&t.popup.destroy()},open:function(){var t,e=this;(!e.ul[0].firstChild||e.ul.find("li").length<1)&&e.bind(),t=e.popup._hovered,e.popup._hovered=!0,e.popup.open(),setTimeout(function(){e.popup._hovered=t},1),e._current&&e.scroll(e._current[0])},dataBind:function(t){for(var e,i=this,n=i.options,a=n.format,o=x.toString,l=i.template,r=t.length,u=0,c="";u<r;u++)e=t[u],s(e,n.min,n.max)&&(c+=l(o(e,a,n.culture)));i._html(c)},refresh:function(){var t,e,s=this,o=s.options,l=o.format,u=i(),c=u<0,d=x.parseDate(s._value),p=d?r(d,o.min):r(new Date,o.min),h=o.min,f=o.max,_=n(h),g=n(f),v=n(a(o.interval)),w=o.interval*z,k=x.toString,y=s.template,b=o.useValueToRender?p:new Date((+o.min)),T=new st(b),S="";e=c?(G+u*z)/w:G/w,_==g&&v!==g||(_>g&&(g+=G),e=(g-_)/w+1),o.timeView&&"scroll"===o.timeView.list?S=s._createListContent(m(l)):s.getDatesInRange(t,g,T,f,w,b).forEach(function(t){S+=y(k(t,l,o.culture))}),s._html(S)},_showAllHiddenItems:function(){var e,i,n=this.list.find(".k-time-container"),a=n.length;for(i=0;i<a;i++)e=t(n[i]),e.find(".k-item:hidden").show(),this._updateListBottomOffset(e)},_updateListBottomOffset:function(t){var e=v(t.find(".k-item:visible").eq(0)),i=t.outerHeight(),n=i-e;t.find(".k-scrollable-placeholder").css({height:t.find("ul").height()+n})},_updateHoursRange:function(){var e,i,n=this,a=x.attr("index"),s=this.ul.find("["+a+'="1"]'),o=this._minHours,l=this._maxHours,r=f(this.options.format.toLowerCase(),"t"),u=this._findSelectedValue(this.ul.find("["+a+'="4"]'));s.length&&(r&&u?("AM"===u?(o<12&&(i=!0),l<12&&(e=!0)):"PM"===u&&(o>12&&(i=!0,o-=12),l>12&&(e=!0,l-=12)),s.find(".k-item").each(function(a,s){s=t(s);var r=+s.attr("data-value");n._validateMin&&i&&r<o||n._validateMax&&e&&r>l?s.hide():s.show()})):s.find(".k-item").each(function(e,i){i=t(i);var a=+i.attr("data-value");n._validateMin&&a<o||n._validateMax&&a>l?i.hide():i.show()}),this._updateListBottomOffset(s))},_updateMinutesRange:function(){var e=this,i=x.attr("index"),n=this.ul.find("["+i+'="2"]'),a=this._minHours,s=this._maxHours,o=this._minMinutes,l=this._maxMinutes,r=+this._findSelectedValue(this.ul.find("["+i+'="1"]')),u=f(this.options.format.toLowerCase(),"t"),c=this._findSelectedValue(this.ul.find("["+i+'="4"]'));u&&"PM"===c&&(r+=12),n.length&&(n.find(".k-item").each(function(i,n){n=t(n);var u=+n.attr("data-value");e._validateMin&&u<o&&a&&r===a||e._validateMax&&u>l&&s&&r===s?n.hide():n.show()}),this._updateListBottomOffset(n))},_updateSecondsRange:function(){var e=this,i=x.attr("index"),n=this.ul.find("["+i+'="3"]'),a=this._minSeconds,s=this._minSeconds,o=this._minMinutes,l=this._maxMinutes,r=+this._findSelectedValue(this.ul.find("["+i+'="2"]'));n.length&&(n.find(".k-item").each(function(i,n){n=t(n);var u=+n.attr("data-value");e._validateMin&&u<a&&o&&r===o||e._validateMax&&u>s&&l&&r===l?n.hide():n.show()}),this._updateListBottomOffset(n))},_updateDesignatorRange:function(){var t=this._minHours,e=this._maxHours,i=x.attr("index"),n=this.ul.find("["+i+'="4"]');n.length&&(this._validateMin&&t>=12?n.find('.k-item[data-value="AM"]').hide():n.find('.k-item[data-value="AM"]').show(),this._validateMax&&e<12?n.find('.k-item[data-value="PM"]').hide():n.find('.k-item[data-value="PM"]').show())},_updateRanges:function(){var t,i;if(this.options.specifiedRange){if(this._currentlySelected||(this._currentlySelected=new Date),t=this.options.max,i=this.options.min,this.options.validateDate){if(this._validateMax=t.getFullYear()===this._currentlySelected.getFullYear()&&t.getMonth()===this._currentlySelected.getMonth()&&t.getDate()===this._currentlySelected.getDate(),this._validateMin=i.getFullYear()===this._currentlySelected.getFullYear()&&i.getMonth()===this._currentlySelected.getMonth()&&i.getDate()===this._currentlySelected.getDate(),!this._validateMax&&!this._validateMin)return this._showAllHiddenItems(),e}else this._validateMax=!0,this._validateMin=!0;this._minMinutes=i.getMinutes(),this._maxMinutes=t.getMinutes(),this._minHours=i.getHours(),this._maxHours=t.getHours(),this._minSeconds=i.getSeconds(),this._maxSeconds=t.getSeconds(),this._updateDesignatorRange(),this._updateHoursRange(),this._updateMinutesRange(),this._updateSecondsRange()}},addTranslate:function(){var t,e,i,n,a,s,o,l=this.ul.find(".k-time-container.k-content.k-scrollable"),r=l.length;for(o=0;o<r;o++)t=l.eq(o),e=v(t.find(".k-item:visible").eq(0)),i=t.outerHeight(),n=(i-e)/2,a="translateY("+n+"px)",s=i-e,t.find("ul").css({transform:a,"-ms-transform":a}),t.find(".k-scrollable-placeholder").css({height:t.find("ul").height()+s}),t.off(A).on("click"+A,".k-item",at(this._itemClickHandler,this)).on("scroll"+A,at(this._listScrollHandler,this))},_nowClickHandler:function(t){t.preventDefault();var e=new Date;this.value(e),this.options.change(x.toString(e,this.options.format,this.options.culture))},_cancelClickHandler:function(t){t.preventDefault(),this.value(this._value),this.popup.close()},_setClickHandler:function(t){t.preventDefault(),this._value=new Date(this._currentlySelected),this.options.change(x.toString(this._currentlySelected,this.options.format,this.options.culture),!0),this.popup.close()},_listScrollHandler:function(e){var i=this,n=v(t(e.currentTarget).find(".k-item:visible").eq(0));i._internalScroll||(i._scrollingTimeout&&clearTimeout(i._scrollingTimeout),i._scrollingTimeout=setTimeout(function(){e.currentTarget.scrollTop%n>1&&(e.currentTarget.scrollTop+=n-e.currentTarget.scrollTop%n),i._scrollTop=e.currentTarget.scrollTop,i._updateCurrentlySelected(),i._updateRanges()},100))},_updateCurrentlySelected:function(){var t,i,n,a,s=f(this.options.format.toLowerCase(),"t"),o=x.attr("index"),l=this.ul.find("["+o+'="1"]'),r=this.ul.find("["+o+'="2"]'),u=this.ul.find("["+o+'="3"]'),c=this.ul.find("["+o+'="4"]');this.ul.is(":visible")&&(this._currentlySelected||(this._currentlySelected=this._value?new Date(this._value):new Date),l.length&&(t=+this._findSelectedValue(l)),r.length&&(i=+this._findSelectedValue(r)),u.length&&(n=+this._findSelectedValue(u)),c.length&&(a=this._findSelectedValue(c)),s&&("PM"==a&&(t+=12,24==t&&(t=12)),"AM"===a&&12===t&&(t=0)),t!==e&&this._currentlySelected.setHours(t),i!==e&&this._currentlySelected.setMinutes(i),n!==e&&this._currentlySelected.setSeconds(n))},_findSelectedValue:function(t){var e=g(t.scrollTop(),v(t.find(".k-item:visible").eq(0)));return t.find(".k-item:visible").eq(e).attr("data-value")},_itemClickHandler:function(e){var i=t(e.originalEvent.currentTarget),n=i.find(".k-item:visible").index(t(e.currentTarget)),a=v(i.find(".k-item:visible").eq(0));i.scrollTop(n*a)},getDatesInRange:function(t,e,i,a,s,o){for(var l=[];;){if(e&&(n(o)>=e||i.getDate()!=o.getDate())){t=n(o),i<o&&(t+=G),t>e&&(o=new st((+a))),n(o)>0&&l.push(new Date(o));break}if(i.getDate()!=o.getDate())break;if(l.push(new Date(o)),o.setTime(o.getTime()+s),!e&&this.options.maxSet)break}return l},_createListContent:function(t){var e,i,n,a=t.length,s="";for(n=0;n<a;n++)e=t[n],"literal"===e.type?s+=this._literalTemplate(e):(i=this._getValues(e,!0),s+=this._itemTemplate(i.values,e,this.options.messages[e.type],i.index));return s},_itemTemplate:function(t,e,i,n){var a,s="",o=t.length,l=x.attr("index");for(s+='<div class="k-time-list-wrapper" role="presentation"><span class="k-title">'+(i||e.type)+'</span><div class="k-time-list"><div class="k-time-container k-content k-scrollable" role="presentation" '+l+'="'+n+'"><ul class="k-reset">',a=0;a<o;a++)s+='<li class="k-item" data-value="'+t[a]+'"><span>'+t[a]+"</span></li>";return s+='</ul><div class="k-scrollable-placeholder"></div></div></div></div>'},_getValues:function(t,e){var i,n,a=[],s=0;for("hour"===t.type?(s=t.hour12?1:0,i=1,n=t.hour12?12:23):"minute"===t.type?(i=2,n=59):"second"===t.type&&(i=3,n=59);s<=n;s++)a.push(e?_(s):s);return{values:a,index:i}},_literalTemplate:function(t){var e='<div class="k-time-separator">'+(" tt"===t.pattern?":":t.pattern)+"</div>";return" tt"===t.pattern&&(e+=this._itemTemplate(["AM","PM"],t,"AM/PM",4)),e},bind:function(){var t=this,e=t.options.dates;e&&e[0]?t.dataBind(e):t.refresh()},_html:function(t){var e=this;e.options.timeView&&"scroll"===e.options.timeView.list?(t=vt+t,e.ul.html(t)):(e.ul[0].innerHTML=t,e.popup.unbind(H,e._heightHandler),e.popup.one(H,e._heightHandler),e.current(null),e.select(e._value))},scroll:function(t){t&&(t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded():w(t))},select:function(e){var i,n=this,a=n.options,s=n._current;e instanceof Date&&(e=x.toString(e,a.format,a.culture)),"string"==typeof e&&(s&&s.text()===e?e=s:(e=t.grep(n.ul[0].childNodes,function(t){return(t.textContent||t.innerText)==e}),e=e[0]?e:null)),i=n._distinctSelection(e),n.current(i)},_distinctSelection:function(e){var i,a,s=this;return e&&e.length>1&&(i=n(s._value),a=t.inArray(i,s._dates),e=s.ul.children()[a]),e},setOptions:function(t){var e=this.options;t.min=T(t.min),t.max=T(t.max),this.options=nt(e,t,{active:e.active,change:e.change,close:e.close,open:e.open}),this.bind()},toggle:function(){var t=this;t.popup.visible()?t.close():t.open()},value:function(t){var e=this;e._value=t,e.ul[0].firstChild&&(e.options.timeView&&"scroll"===e.options.timeView.list?e.applyValue(t):e.select(t))},_click:function(e){var i=this,n=t(e.currentTarget),a=n.text(),s=i.options.dates;s&&s.length>0&&(a=s[n.index()]),e.isDefaultPrevented()||(i.select(n),i.options.change(a,!0),i.close())},_height:function(){var t=this,e=t.list,i=e.parent(".k-animation-container"),n=t.options.height;t.ul[0].children.length&&e.add(i).show().height(t.ul[0].scrollHeight>n?n:"auto").hide()},_parse:function(t){var e=this,i=e.options,a=n(i.min)!=n(mt)?i.min:null,s=n(i.max)!=n(mt)?i.max:null,o=e._value||a||s||mt;return t instanceof st?t:(t=T(t,i.parseFormats,i.culture),t&&(t=new st(o.getFullYear(),o.getMonth(),o.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())),t)},_adjustListWidth:function(){var t,e,i=this.list,n=i[0].style.width,a=this.options.anchor,s=x._outerWidth;!i.data("width")&&n||(t=window.getComputedStyle?window.getComputedStyle(a[0],null):0,e=t?parseFloat(t.width):s(a),t&&(V.mozilla||V.msie)&&(e+=parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)+parseFloat(t.borderLeftWidth)+parseFloat(t.borderRightWidth)),n=e-(s(i)-i.width()),i.css({fontFamily:a.css("font-family"),width:n}).data("width",n))},_popup:function(){var t=this,e=t.list,i=t.options,n=i.anchor;this.options.omitPopup?e.appendTo(i.timeDiv):t.popup=new C.Popup(e,nt(i.popup,{anchor:n,open:i.open,close:i.close,animation:i.animation,isRtl:D.isRtl(i.anchor),activate:function(){t.options.timeView&&"scroll"===t.options.timeView.list&&(t.addTranslate(),t._value?t.applyValue(t._value):t._updateCurrentlySelected(),t._updateRanges(),t._focusList(t.list.find(".k-time-list-wrapper").eq(0)))}}))},move:function(t){var i=this,n=t.keyCode,a=i.ul[0],s=i._current,o=n===b.DOWN;if(n===b.UP||o){if(t.altKey)return i.toggle(o),e;s=o?s?s[0].nextSibling:a.firstChild:s?s[0].previousSibling:a.lastChild,s&&i.select(s),i.options.change(i._current.text()),t.preventDefault()}else n!==b.ENTER&&n!==b.TAB&&n!==b.ESC||(t.preventDefault(),s&&i.options.change(s.text(),!0),i.close())}},k.getMilliseconds=n,x.TimeView=k,y=L.extend({init:function(e,i){var a,s,l,r,u,c,d=this;i=i||{},i.componentType=i.componentType||"classic",L.fn.init.call(d,e,i),e=d.element,i=d.options,i.min=T(e.attr("min"))||T(i.min),i.max=T(e.attr("max"))||T(i.max),+i.max==+mt&&+i.min==+mt||(this._specifiedRange=!0),o(i),d._initialOptions=nt({},i),d._wrapper(),d.options.timeView&&"scroll"===d.options.timeView.list&&(d.options.height=null),d.timeView=s=new k(nt({},i,{id:e.attr(et),anchor:d.wrapper,format:i.format,change:function(t,i){i?d._change(t):e.val(t)},open:function(t){d.options.timeView&&"scroll"!==d.options.timeView.list?d.timeView._adjustListWidth():d.timeView._updateTitle(),d.trigger(H)?t.preventDefault():(e.attr(X,!0),a.attr(Z,!1))},close:function(t){d.trigger(I)?t.preventDefault():(e.attr(X,!1),a.attr(Z,!0))},active:function(t){e&&e.length&&e[0].removeAttribute(tt),t&&e.attr(tt,s._optionID)},specifiedRange:d._specifiedRange,maxSet:+i.max!=+mt})),a=s.ul,d._icon(),d._reset();try{e[0].setAttribute("type","text")}catch(p){e[0].type="text"}e.addClass("k-input").attr({role:"combobox","aria-expanded":!1,"aria-owns":s._timeViewID,autocomplete:"off"}),l=e.is("[disabled]")||t(d.element).parents("fieldset").is(":disabled"),l?d.enable(!1):d.readonly(e.is("[readonly]")),i.dateInput&&(r=i.min,u=i.max,c=new st,n(r)==n(u)&&(r=new st(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0),u=new st(c.getFullYear(),c.getMonth(),c.getDate(),24,0,0)),d._dateInput=new C.DateInput(e,{culture:i.culture,format:i.format,min:r,max:u,value:i.value,interval:i.interval})),d._old=d._update(i.value||d.element.val()),d._oldText=e.val(),x.notify(d)},options:{name:"TimePicker",min:mt,max:mt,format:"",dates:[],parseFormats:[],value:null,interval:30,height:200,animation:{},dateInput:!1,messages:{set:"Set",cancel:"Cancel",hour:"hour",minute:"minute",second:"second",millisecond:"millisecond",now:"Now"},componentType:"classic"},events:[H,I,R],componentTypes:{classic:{timeView:{list:"list"}},modern:{timeView:{list:"scroll"}}},setOptions:function(t){var e=this,i=e._value;L.fn.setOptions.call(e,t),t=e.options,+t.max==+mt&&+t.min==+mt||(this._specifiedRange=!0),o(t),e.timeView.setOptions(t),i&&e.element.val(x.toString(i,t.format,t.culture))},dataBind:function(t){it(t)&&this.timeView.dataBind(t)},_editable:function(t){var e=this,i=t.disable,n=t.readonly,a=e._arrow.off(A),s=e.element.off(A),o=e._inputWrapper.off(A);e._dateInput&&e._dateInput._unbindInput(),n||i?(o.addClass(i?Q:F).removeClass(i?F:Q),s.attr(q,i).attr(E,n).attr(J,i).attr($,n)):(o.addClass(F).removeClass(Q).on(Y,e._toggleHover),s&&s.length&&(s[0].removeAttribute(q),s[0].removeAttribute(E)),s.attr(J,!1).attr($,!1).on("keydown"+A,at(e._keydown,e)).on("focusout"+A,at(e._blur,e)).on("focus"+A,function(){e._inputWrapper.addClass(N)}),e._dateInput&&e._dateInput._bindInput(),a.on(P,at(e._click,e)).on(K,l))},readonly:function(t){this._editable({readonly:t===e||t,disable:!1})},enable:function(t){this._editable({readonly:!1,disable:!(t=t===e||t)})},destroy:function(){var t=this;L.fn.destroy.call(t),t.timeView.destroy(),t.element.off(A),t._arrow.off(A),t._inputWrapper.off(A),t._form&&t._form.off("reset",t._resetHandler)},close:function(){this.timeView.close()},open:function(){this.timeView.open()},min:function(t){return t&&(this._specifiedRange=!0),this._option("min",t)},max:function(t){return t&&this.timeView?(this._specifiedRange=!0,this.timeView.options.maxSet=!0):this.timeView&&(this.timeView.options.maxSet=!1),this._option("max",t)},value:function(t){var i=this;return t===e?i._value:(i._old=i._update(t),null===i._old&&i.element.val(""),i._oldText=i.element.val(),e)},_blur:function(){var t=this,e=t.element.val();t.options.timeView&&"scroll"===t.options.timeView.list||t.close(),e!==t._oldText&&t._change(e),t._inputWrapper.removeClass(N)},_click:function(){var t=this,e=t.element;t.timeView.toggle(),D.touch||e[0]===S()||e.trigger("focus")},_change:function(t){var e,i,n,a=this,s=a.element.val();t=a._update(t),e=!x.calendar.isEqualDate(a._old,t),i=e&&!a._typing,n=s!==a.element.val(),(i||n)&&a.element.trigger(R),e&&(a._old=t,a._oldText=a.element.val(),a.trigger(R)),a._typing=!1},_icon:function(){var e,i=this,n=i.element;e=n.next("span.k-select"),e[0]||(e=t('<span unselectable="on" class="k-select" aria-label="select"><span class="k-icon k-i-clock"></span></span>').insertAfter(n)),i._arrow=e.attr({role:"button","aria-controls":i.timeView._timeViewID})},_keydown:function(t){var e=this,i=t.keyCode,n=e.timeView,a=e.element.val();n.popup.visible()||t.altKey?(n.move(t),e._dateInput&&t.stopImmediatePropagation&&t.stopImmediatePropagation()):i===b.ENTER&&a!==e._oldText?e._change(a):e._typing=!0},_option:function(t,i){var n=this,a=n.options;return i===e?a[t]:(i=n.timeView._parse(i),i&&(i=new st((+i)),a[t]=i,n.timeView.options[t]=i,n.timeView.bind()),e)},_toggleHover:function(e){t(e.currentTarget).toggleClass(B,"mouseenter"===e.type)},_update:function(t){var e=this,i=e.options,n=e.timeView,a=n._parse(t);return s(a,i.min,i.max)||(a=null),e._value=a,e._currentlySelected=a,e._dateInput&&a?e._dateInput.value(a||t):e.element.val(x.toString(a||t,i.format,i.culture)),n.value(a),a},_wrapper:function(){var e,i=this,n=i.element;e=n.parents(".k-timepicker"),e[0]||(e=n.wrap(W).parent().addClass("k-picker-wrap k-state-default"),e=e.wrap(W).parent()),e[0].style.cssText=n[0].style.cssText,i.wrapper=e.addClass("k-widget k-timepicker").addClass(n[0].className),n.css({width:"100%",height:n[0].style.height}),i._inputWrapper=t(e[0].firstChild)},_reset:function(){var e=this,i=e.element,n=i.attr("form"),a=n?t("#"+n):i.closest("form");a[0]&&(e._resetHandler=function(){e.value(i[0].defaultValue),e.max(e._initialOptions.max),e.min(e._initialOptions.min)},e._form=a.on("reset",e._resetHandler))}}),C.plugin(y)}(window.kendo.jQuery),window.kendo},i(3))}});