UNPKG

@progress/kendo-ui

Version:

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

3 lines (2 loc) 30.2 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("kendo.calendar.js"),require("kendo.popup.js"),require("kendo.dateinput.js"),require("kendo.html.button.js"),require("kendo.label.js"),require("kendo.actionsheet.js")):"function"==typeof define&&define.amd?define(["exports","kendo.calendar","kendo.popup","kendo.dateinput","kendo.html.button","kendo.label","kendo.actionsheet"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).kendo=e.kendo||{},e.kendo._globals=e.kendo._globals||{},e.kendo._globals.Timepicker={}))}(this,(function(e){!function(e,t){var i=window.kendo,n=i.keys,o=i.html,a=i.parseDate,s=i.htmlEncode,l=i._activeElement,r=i._extractFormat,u=i.support,c=u.browser,d=i.mediaQuery,p=i.ui,h=p.Widget,m="open",f="close",_="change",g=".kendoTimePicker",v="click"+g,b="disabled",w="readonly",k="li",y="k-focus",T="k-hover",M="mouseenter"+g+" mouseleave"+g,S="mousedown"+g,x=6e4,V=864e5,L="k-selected",C="k-disabled",D="aria-selected",H="aria-expanded",I="aria-hidden",P="aria-disabled",R="aria-readonly",F="aria-activedescendant",A="id",Q=Array.isArray,O=e.extend,z=Date,q=new z,j=({mainSize:e,messages:t,buttonSize:n})=>`<div><div tabindex="0" class="k-timeselector ${e}"><div class="k-time-header"><span class="k-title"></span>`+i.html.renderButton(`<button class="k-time-now" title="Select now" aria-label="Select now">${s(t.now)}</button>`,{fillMode:"flat",size:n})+'</div><div class="k-time-list-container"><span class="k-time-highlight"></span></div></div>'+E(n,t)+"</div>",E=(e,t)=>'<div class="k-time-footer k-actions k-actions-stretched k-actions-horizontal">'+i.html.renderButton(`<button class="k-time-accept" title="Set time" aria-label="Set time">${s(t.set)}</button>`,{size:e,themeColor:"primary"})+i.html.renderButton(`<button class="k-time-cancel" title="Cancel changes" aria-label="Cancel changes">${s(t.cancel)}</button>`,{size:e})+"</div>";q=new Date(q.getFullYear(),q.getMonth(),q.getDate(),0,0,0);var B=function(e){var t=this,n=e.focusTime,o=e.id;t.options=e,t._dates=[],t.bigScreenMQL=d("large"),t.smallScreenMQL=d("small"),"auto"==t.options.adaptiveMode&&t.smallScreenMQL.onChange((function(){t.popup&&i.isFunction(t.popup.fullscreen)&&(t.popup.fullscreen(t.smallScreenMQL.mediaQueryList.matches),t.options.timeView&&"scroll"===t.options.timeView.list&&(t.addTranslate(),t._updateRanges()))})),t._createList(e.timeView&&"scroll"===e.timeView.list),n&&(t._focusTime=new z(q.getFullYear(),q.getMonth(),q.getDate(),n.getHours(),n.getMinutes(),n.getSeconds())),o&&(t._timeViewID=o+"_timeview",t._optionID=o+"_option_selected",t.ul.attr(A,t._timeViewID)),t._heightHandler=t._height.bind(t),t._popup()};function N(e){return 60*e.getHours()*x+e.getMinutes()*x+1e3*e.getSeconds()+e.getMilliseconds()}function Y(e,t,i){var n,o=N(t),a=N(i);return!e||o==a||(o>(n=N(e))&&(n+=V),a<o&&(a+=V),n>=o&&n<=a)}B.prototype={_createList:function(e){e?this._createScrollList():this._createClassicRenderingList()},_createScrollList:function(){var t="auto"!=this.options.adaptiveMode||this.bigScreenMQL.mediaQueryList.matches?this.options.size||"medium":"large",n=e.extend({},this.options,{mainSize:i.getValidCssClass("k-timeselector-","size",t),buttonSize:t});this.popupContent=e(i.template(j)(n)).on(S,K),this.list=this.popupContent.find(".k-timeselector"),this.ul=this.list.find(".k-time-list-container"),this.list.on("click"+g,".k-time-header button.k-time-now",this._nowClickHandler.bind(this)),this.popupContent.on("click"+g,".k-time-footer button.k-time-cancel",this._cancelClickHandler.bind(this)),this.popupContent.on("click"+g,".k-time-footer button.k-time-accept",this._setClickHandler.bind(this)),this.list.on("mouseover"+g,".k-time-list-wrapper",this._mouseOverHandler.bind(this)),this.list.on("keydown"+g,this._scrollerKeyDownHandler.bind(this))},_scrollerKeyDownHandler:function(t){var o=this,a=t.keyCode,s=e(t.currentTarget).find(".k-time-list-wrapper.k-focus"),l=o.list.find(".k-time-list-wrapper"),r=l.length,u=l.index(s),c=i.support.isRtl(o.wrapper),d=X(s.find(".k-item:visible").eq(0)),p=s.find(".k-time-container.k-content.k-scrollable");s.length&&(a==n.RIGHT&&!c||a==n.LEFT&&c?u+1<r&&o._focusList(l.eq(u+1)):a==n.LEFT&&!c||a==n.RIGHT&&c?u-1>=0&&o._focusList(l.eq(u-1)):a==n.UP?(p.scrollTop(p.scrollTop()-d),t.preventDefault()):a==n.DOWN?(p.scrollTop(p.scrollTop()+d),t.preventDefault()):a===n.ENTER?o._setClickHandler(t):a===n.ESC&&o._cancelClickHandler(t))},_mouseOverHandler:function(t){this._focusList(e(t.currentTarget))},_focusList:function(e){this.list.find(".k-time-list-wrapper").removeClass(y),e.addClass(y),this.list.trigger("focus"),this._scrollTop=e.find(".k-scrollable").scrollTop()},_createClassicRenderingList:function(){var t=this,n=e('<div class="k-list '+i.getValidCssClass("k-list-","size",t.options.size)+'"><div class="k-list-content"><ul tabindex="-1" role="listbox" aria-hidden="true" unselectable="on" class="k-list-ul"/></div></div>');t.ul=n.find("ul").css({overflow:u.kineticScrollNeeded?"":"auto"}).on(v,k,t._click.bind(t)).on("mouseenter"+g,k,(function(){e(this).addClass(T)})).on("mouseleave"+g,k,(function(){e(this).removeClass(T)})),t.list=e("<div class='k-list-container k-list-scroller' unselectable='on'/>").append(n).on(S,K),t.template=e=>`<li tabindex="-1" role="option" class="k-list-item" unselectable="on"><span class="k-list-item-text">${e}</span></li>`},current:function(i){var n=this,o=n.options.active;if(i===t)return n._current;n._current&&(n._current.removeClass(L),n._current&&n._current.length&&(n._current[0].removeAttribute(A),n._current[0].removeAttribute(D))),i&&(i=e(i).addClass(L).attr(A,n._optionID).attr(D,!0),n.scroll(i[0])),n._current=i,o&&o(i)},_updateTitle:function(){this.list.find(".k-time-header > .k-title").html(i.toString(this._value,this.options.format,this.options.culture))},applyValue:function(e){if(e){var t,n=U(this.options.format.toLowerCase(),"t"),o=e.getHours(),a=e.getMinutes(),s=e.getSeconds(),l=i.attr("index"),r=this.ul.find("["+l+'="1"]'),u=this.ul.find("["+l+'="2"]'),c=this.ul.find("["+l+'="3"]'),d=this.ul.find("["+l+'="4"]');n&&(o>=12?(t="PM",o>12&&(o-=12)):(t="AM",0===o&&(o=12))),this._internalScroll=!0,r.length&&this._scrollListToPosition(r,o),u.length&&this._scrollListToPosition(u,a),c.length&&this._scrollListToPosition(c,s),d.length&&this._scrollListToPosition(d,t),this._internalScroll=!1}},_scrollListToPosition:function(e,t){var i=e.find('.k-item[data-value="'+J(t)+'"]'),n=X(i);e.scrollTop(e.find(".k-item:visible").index(i)*n)},close:function(){this.popup&&this.popup.close()},destroy:function(){var e=this;e.ul.off(g),e.list.off(g),e.popupContent&&e.popupContent.off(g),e.popup&&e.popup.destroy(),e.bigScreenMQL&&e.bigScreenMQL.destroy(),e.smallScreenMQL&&e.smallScreenMQL.destroy()},open:function(){var e,t=this;(!t.ul[0].firstChild||t.ul.find("li").length<1)&&t.bind(),t._focusTime&&t.value(t._focusTime),e=t.popup._hovered,t.popup._hovered=!0,t.popup.open(),setTimeout((function(){t.popup._hovered=e}),1),t._current&&t.scroll(t._current[0])},dataBind:function(e){for(var t,n=this,o=n.options,a=o.format,s=i.toString,l=n.template,r=e.length,u=0,c="";u<r;u++)Y(t=e[u],o.min,o.max)&&(c+=l(s(t,a,o.culture)));n._html(c)},refresh:function(){var e,t,n,o,a,s=this,l=s.options,r=l.format,u=(n=new z,o=new z(n.getFullYear(),n.getMonth(),n.getDate(),0,0,0),a=new z(n.getFullYear(),n.getMonth(),n.getDate(),12,0,0),-1*(o.getTimezoneOffset()-a.getTimezoneOffset())),c=u<0,d=i.parseDate(s._value),p=G(d||new Date,l.min),h=l.min,m=l.max,f=N(h),_=N(m),g=N((e=l.interval,(t=new Date(2100,0,1)).setMinutes(-e),t)),v=l.interval*x,b=i.toString,w=s.template,k=l.useValueToRender?p:new Date(+l.min),y=new z(k),T="";f==_&&g!==_||f>_&&(_+=V),l.timeView&&"scroll"===l.timeView.list?T=s._createListContent(i.date.splitDateFormat(r),l.interval):s.getDatesInRange(undefined,_,y,m,v,k).forEach((function(e){T+=w(b(e,r,l.culture))})),s._html(T)},_showAllHiddenItems:function(){for(var t,i=this.list.find(".k-time-container"),n=i.length,o=0;o<n;o++)(t=e(i[o])).find(".k-item:hidden").show(),this._updateListBottomOffset(t)},_updateListBottomOffset:function(e){var t=X(e.find(".k-item:visible").eq(0)),i=e.outerHeight()-t;e.find(".k-scrollable-placeholder").css({height:e.find("ul").height()+i})},_updateHoursRange:function(){var t,n,o=this,a=i.attr("index"),s=this.ul.find("["+a+'="1"]'),l=this._minHours,r=this._maxHours,u=U(this.options.format.toLowerCase(),"t"),c=this._findSelectedValue(this.ul.find("["+a+'="4"]'));s.length&&(u&&c?("AM"===c?(l<12&&(n=!0),r<12&&(t=!0)):"PM"===c&&(l>12&&(n=!0,l-=12),r>12&&(t=!0,r-=12)),s.find(".k-item").each((function(i,a){var s=+(a=e(a)).attr("data-value");o._validateMin&&n&&s<l||o._validateMax&&t&&s>r?a.hide():a.show()}))):s.find(".k-item").each((function(t,i){var n=+(i=e(i)).attr("data-value");o._validateMin&&n<l||o._validateMax&&n>r?i.hide():i.show()})),this._updateListBottomOffset(s))},_updateMinutesRange:function(){var t=this,n=i.attr("index"),o=this.ul.find("["+n+'="2"]'),a=this._minHours,s=this._maxHours,l=this._minMinutes,r=this._maxMinutes,u=+this._findSelectedValue(this.ul.find("["+n+'="1"]')),c=U(this.options.format.toLowerCase(),"t"),d=this._findSelectedValue(this.ul.find("["+n+'="4"]'));c&&"PM"===d&&(u+=12),o.length&&(o.find(".k-item").each((function(i,n){var o=+(n=e(n)).attr("data-value");t._validateMin&&o<l&&(a&&u)===a||t._validateMax&&o>r&&(s&&u)===s?n.hide():n.show()})),this._updateListBottomOffset(o))},_updateSecondsRange:function(){var t=this,n=i.attr("index"),o=this.ul.find("["+n+'="3"]'),a=this._minSeconds,s=this._minSeconds,l=this._minMinutes,r=this._maxMinutes,u=+this._findSelectedValue(this.ul.find("["+n+'="2"]'));o.length&&(o.find(".k-item").each((function(i,n){var o=+(n=e(n)).attr("data-value");t._validateMin&&o<a&&l&&u===l||t._validateMax&&o>s&&r&&u===r?n.hide():n.show()})),this._updateListBottomOffset(o))},_updateDesignatorRange:function(){var e=this._minHours,t=this._maxHours,n=i.attr("index"),o=this.ul.find("["+n+'="4"]');o.length&&(this._validateMin&&e>=12?o.find('.k-item[data-value="AM"]').hide():o.find('.k-item[data-value="AM"]').show(),this._validateMax&&t<12?o.find('.k-item[data-value="PM"]').hide():o.find('.k-item[data-value="PM"]').show())},_updateRanges:function(){if(this.options.specifiedRange){this._currentlySelected||(this._currentlySelected=new Date);var e=this.options.endTime?this.options.endTime:this.options.max,t=this.options.startTime?this.options.startTime:this.options.min;if(this.options.validateDate){if(e.getFullYear()===this._currentlySelected.getFullYear()&&e.getMonth()===this._currentlySelected.getMonth()&&e.getDate()===this._currentlySelected.getDate()?this._validateMax=!0:this._validateMax=!1,t.getFullYear()===this._currentlySelected.getFullYear()&&t.getMonth()===this._currentlySelected.getMonth()&&t.getDate()===this._currentlySelected.getDate()?this._validateMin=!0:this._validateMin=!1,!this._validateMax&&!this._validateMin)return void this._showAllHiddenItems()}else this._validateMax=!0,this._validateMin=!0;this._minMinutes=t.getMinutes(),this._maxMinutes=e.getMinutes(),this._minHours=t.getHours(),this._maxHours=e.getHours(),this._minSeconds=t.getSeconds(),this._maxSeconds=e.getSeconds(),this._updateDesignatorRange(),this._updateHoursRange(),this._updateMinutesRange(),this._updateSecondsRange()}},addTranslate:function(){for(var e,t,i,n,o,a=this.ul.find(".k-time-container.k-content.k-scrollable"),s=a.length,l=0;l<s;l++)t=X((e=a.eq(l)).find(".k-item:visible").eq(0)),n="translateY("+((i=e.outerHeight())-t)/2+"px)",o=i-t,e.find("ul").css({transform:n,"-ms-transform":n}),e.find(".k-scrollable-placeholder").css({height:e.find("ul").height()+o}),e.off(g).on("click"+g,".k-item",this._itemClickHandler.bind(this)).on("scroll"+g,this._listScrollHandler.bind(this))},_nowClickHandler:function(e){e.preventDefault();var t=new Date;this.value(t),this.options.change(i.toString(t,this.options.format,this.options.culture),!0)},_cancelClickHandler:function(e){e.preventDefault(),this.value(this._value),this.popup&&this.popup.close()},_setClickHandler:function(e){e.preventDefault(),this._value=new Date(this._currentlySelected),this.options.change(i.toString(this._currentlySelected,this.options.format,this.options.culture),!0),this.popup&&this.popup.close()},_listScrollHandler:function(t){var i=this,n=X(e(t.currentTarget).find(".k-item:visible").eq(0));i._internalScroll||(i._scrollingTimeout&&clearTimeout(i._scrollingTimeout),i._scrollingTimeout=setTimeout((function(){t.currentTarget.scrollTop%n>1&&(t.currentTarget.scrollTop+=n-t.currentTarget.scrollTop%n),i._scrollTop=t.currentTarget.scrollTop,i._updateRanges(),i._updateCurrentlySelected()}),100))},_updateCurrentlySelected:function(){var e,n,o,a,s=U(this.options.format.toLowerCase(),"t"),l=i.attr("index"),r=this.ul.find("["+l+'="1"]'),u=this.ul.find("["+l+'="2"]'),c=this.ul.find("["+l+'="3"]'),d=this.ul.find("["+l+'="4"]');this.ul.is(":visible")&&(this._currentlySelected||(this._currentlySelected=this._value?new Date(this._value):new Date),r.length&&(e=+this._findSelectedValue(r)),u.length&&(n=+this._findSelectedValue(u)),c.length&&(o=+this._findSelectedValue(c)),d.length&&(a=this._findSelectedValue(d)),s&&("PM"==a&&24==(e+=12)&&(e=12),"AM"===a&&12===e&&(e=0)),e!==t&&this._currentlySelected.setHours(e),n!==t&&this._currentlySelected.setMinutes(n),o!==t&&this._currentlySelected.setSeconds(o))},_findSelectedValue:function(e){var t,i,n=(t=e.scrollTop(),i=X(e.find(".k-item:visible").eq(0)),Math.max(Math.round(t/i),0));return e.find(".k-item:visible").eq(n).attr("data-value")},_itemClickHandler:function(t){var i=e(t.originalEvent.currentTarget),n=i.find(".k-item:visible").index(e(t.currentTarget)),o=X(i.find(".k-item:visible").eq(0));i.scrollTop(n*o)},getDatesInRange:function(e,t,i,n,o,a){for(var s=[];;){if(t&&(N(a)>=t||i.getDate()!=a.getDate())){e=N(a),i<a&&(e+=V),e>t&&(a=new z(+n)),N(a)>0&&s.push(new Date(a));break}if(i.getDate()!=a.getDate())break;if(s.push(new Date(a)),a.setTime(a.getTime()+o),!t&&this.options.maxSet&&!this._ignoreMaxSet)break}return s},_createListContent:function(e,t){for(var i,n,o=e.length,a="",s=0;s<o;s++)"literal"===(i=e[s]).type||"dayperiod"==i.type?a+=this._literalTemplate(i):(n=this._getValues(i,!0,t),a+=this._itemTemplate(n.values,i,this.options.messages[i.type],n.index));return a},_itemTemplate:function(e,t,n,o){var a="",s=e.length,l=i.attr("index");a+='<div class="k-time-list-wrapper" role="presentation"><span class="k-title">'+(n||t.type)+'</span><div class="k-time-list"><div class="k-time-container k-content k-scrollable" role="presentation" '+l+'="'+o+'"><ul class="k-reset">';for(var r=0;r<s;r++)a+='<li class="k-item" data-value="'+e[r]+'"><span>'+e[r]+"</span></li>";return a+='</ul><div class="k-scrollable-placeholder"></div></div></div></div>'},_getValues:function(t,i,n){var o,a,s=[],l=0,r=0,u=0;for(e.isPlainObject(n)&&(r=n[t.type]||0),"hour"===t.type?(l=t.hour12?1:0,o=1,a=t.hour12?12:23):"minute"===t.type?(o=2,a=59):"second"===t.type&&(o=3,a=59);l<=a;l++)r>0?((0===l||1===l&&r>1&&"hour"===t.type)&&s.push(i?J(u):u),l%r==0&&u+r<=a&&(u+=r,s.push(i?J(u):u))):s.push(i?J(l):l);return{values:s,index:o}},_literalTemplate:function(e){var t=" tt"===e.pattern||"aa"===e.pattern,i='<div class="k-time-separator">'+(t?":":e.pattern)+"</div>";return t&&(i+=this._itemTemplate(["AM","PM"],e,"AM/PM",4)),i},bind:function(){var e=this,t=e.options,i=t.dates;!i||!i[0]||t.timeView&&"scroll"===t.timeView.list?(e.refresh(),e.addTranslate(),e._value&&e.applyValue(e._value)):e.dataBind(i)},_html:function(e){var t=this;t.options.timeView&&"scroll"===t.options.timeView.list?(e='<span class="k-time-highlight"></span>'+e,t.ul.html(e)):(t.ul[0].innerHTML=e,t.popup.unbind(m,t._heightHandler),t.popup.one(m,t._heightHandler),t.current(null),t.select(t._value))},scroll:function(e){e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded():function(e,t){function i(e,t){return{start:e,length:t,end:e+t}}function n(e,i){return!1===t||i.start<e.end&&e.start<i.end?Math.min(e.start,Math.max(i.start,e.end-i.length)):(e.start+e.end-i.length)/2}function o(e,t){return{x:e,y:t,translate:function(i,n){return o(e+i,t+n)}}}function a(e,t){for(;e;)t=t.translate(e.offsetLeft,e.offsetTop),e=e.offsetParent;return t}var s,l=a(e,o(0,0)),r=o(e.offsetWidth,e.offsetHeight),u=e.parentNode;for(;u instanceof HTMLElement;)s=a(u,o(u.clientLeft,u.clientTop)),u.scrollLeft=n(i(l.x-s.x,r.x),i(u.scrollLeft,u.clientWidth)),u.scrollTop=n(i(l.y-s.y,r.y),i(u.scrollTop,u.clientHeight)),l=l.translate(-u.scrollLeft,-u.scrollTop),u=u.parentNode}(e))},select:function(t){var n,o=this,a=o.options,s=o._current;t instanceof Date&&(t=i.toString(t,a.format,a.culture)),"string"==typeof t&&(t=s&&s.text()===t?s:(t=e.grep(o.ul[0].childNodes,(function(e){return(e.textContent||e.innerText)==t})))[0]?t:null),n=o._distinctSelection(t),o.current(n)},_distinctSelection:function(t){var i,n,o=this;return t&&t.length>1&&(i=N(o._value),n=e.inArray(i,o._dates),t=o.ul.children()[n]),t},setOptions:function(e){var t=this.options;e.min=a(e.min),e.max=a(e.max),this.options=O(t,e,{active:t.active,change:t.change,close:t.close,open:t.open}),this.bind()},toggle:function(){var e=this;e.popup.visible()?e.close():e.open()},value:function(e){var t=this;t._value=e,t.ul[0].firstChild&&(t.options.timeView&&"scroll"===t.options.timeView.list?t.applyValue(e):t.select(e))},_click:function(t){let i=this,n=e(t.currentTarget),o=n.text(),a=i.options.dates,s=i.options.min,l=i.options.max;a&&a.length>0&&(s.getTime()!==l.getTime()&&(a=a.filter((e=>i._inRange(e)))),o=a[n.index()]),t.isDefaultPrevented()||(i.select(n),i.options.change(o,!0),i.close())},_inRange(e){const t=this.options.min,i=this.options.max,n=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),o=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),a=3600*i.getHours()+60*i.getMinutes()+i.getSeconds();return n>=o&&n<=a},_height:function(){var e=this,t=e.list,i=t.parent(".k-child-animation-container"),n=i.closest(".k-animation-container"),o=e.options.height,a=t.add(n),s=e.ul[0];s.children.length&&(a.add(i).show(),t.add(i).height(s.scrollHeight>o&&("auto"!=e.options.adaptiveMode||e.bigScreenMQL.mediaQueryList.matches)?o:"auto"),a.hide())},_parse:function(e){var t=this.options,i=N(t.min)!=N(q)?t.min:null,n=N(t.max)!=N(q)?t.max:null,o=this._value||i||n||q;return e instanceof z||(e=a(e,t.parseFormats,t.culture))&&(e=new z(o.getFullYear(),o.getMonth(),o.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),e},_adjustListWidth:function(){var e,t,n=this.list,o=n[0].style.width,a=this.options.anchor,s=i._outerWidth;!n.data("width")&&o||(t=(e=window.getComputedStyle?window.getComputedStyle(a[0],null):0)?parseFloat(e.width):s(a),e&&(c.mozilla||c.msie)&&(t+=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth)),o=t-(s(n)-n.width()),n.css({fontFamily:a.css("font-family"),width:"auto"!=this.options.adaptiveMode||this.bigScreenMQL.mediaQueryList.matches?o:"100%"}).data("width",o))},_popup:function(){var e=this,t=e.list,i=e.options,n=i.anchor;if(this.options.omitPopup)t.appendTo(i.timeDiv);else if("auto"!=i.adaptiveMode||e.bigScreenMQL.mediaQueryList.matches)e.popup=new p.Popup(e.popupContent||t,O(i.popup,{anchor:n,open:i.open,close:i.close,animation:i.animation,isRtl:u.isRtl(i.anchor),activate:function(){e.options.timeView&&"scroll"===e.options.timeView.list&&(e.addTranslate(),e._updateRanges(),e._value?e.applyValue(e._value):e._updateCurrentlySelected(),e._focusList(e.list.find(".k-time-list-wrapper").eq(0)))}}));else{var o=e.popupContent||t;o.appendTo(document.body),e.popup=new p.ActionSheet(o,{adaptive:!0,focusOnActivate:!1,title:"Set time",subtitle:"00/00/00",closeButton:!0,fullscreen:e.smallScreenMQL.mediaQueryList.matches,popup:O(i.popup,{anchor:n,open:i.open,close:i.close,animation:i.animation,isRtl:u.isRtl(i.anchor)}),activate:function(){e.options.timeView&&"scroll"===e.options.timeView.list&&(e.addTranslate(),e._updateRanges(),e._value?e.applyValue(e._value):e._updateCurrentlySelected(),e._focusList(e.list.find(".k-time-list-wrapper").eq(0)))}}),e._updateRanges(),e._updateCurrentlySelected(),o.find(".k-time-footer").appendTo(o)}},move:function(t){const i=this,o=t.keyCode,a=i.ul[0],s=o===n.DOWN,l=e(t.target).is(".k-input-inner"),r="modern"===i.options.componentType,u=i.popup.visible();let c=i._current;const d=l&&r&&u;if(o===n.UP||s){if(t.altKey)return void i.toggle(s);if(d)return;c=s?c?c[0].nextSibling:a.firstChild:c?c[0].previousSibling:a.lastChild,c&&i.select(c),i.options.change(i._current.text()),t.preventDefault()}else o!==n.ENTER&&o!==n.TAB&&o!==n.ESC||(t.preventDefault(),c&&i.options.change(c.text(),!0),i.close())}},B.getMilliseconds=N,i.TimeView=B;var W=h.extend({init:function(t,n){var o=this;(n=n||{}).componentType=n.componentType||"classic",e.isPlainObject(n.interval)&&"modern"!==n.componentType&&(n.interval=30),h.fn.init.call(o,t,n),t=o.element,(n=o.options).min=a(t.attr("min"))||a(n.min),n.max=a(t.attr("max"))||a(n.max),n.inputMode=n.inputMode||t.attr("inputmode")||"text",t.attr("inputmode",n.inputMode),+n.max==+q&&+n.min==+q||(this._specifiedRange=!0),$(n),o._initialOptions=O({},n),o._wrapper(),o.options.timeView&&"scroll"===o.options.timeView.list&&(o.options.height=null),o.bigScreenMQL=d("large"),"auto"==o.options.adaptiveMode&&o.bigScreenMQL.onChange((()=>{o._createTimeViewProxy(),o._update(o.element.val())})),o._createTimeView(),o._createTimeViewProxy=o._createTimeView.bind(o),o._icon(),o._reset();try{t[0].setAttribute("type","text")}catch(e){t[0].type="text"}t.addClass("k-input-inner").attr({role:"combobox","aria-expanded":!1,"aria-controls":o.timeView._timeViewID,autocomplete:"off"}),t.is("[disabled]")||e(o.element).parents("fieldset").is(":disabled")?o.enable(!1):o.readonly(t.is("[readonly]")),o._createDateInput(),o._old=o._update(n.value||o.element.val()),o._oldText=t.val(),o._applyCssClasses(),n.label&&o._label(),o.element.removeAttr("style"),i.notify(o)},options:{name:"TimePicker",autoAdjust:!0,min:q,max:q,format:"",dates:[],parseFormats:[],focusTime:null,value:null,interval:30,height:200,animation:{},dateInput:!1,messages:{set:"Set",cancel:"Cancel",hour:"hour",minute:"minute",second:"second",millisecond:"millisecond",now:"Now"},adaptiveMode:"none",componentType:"classic",size:"medium",fillMode:"solid",rounded:"medium",label:null,autoCorrectParts:!0},events:[m,f,_],componentTypes:{classic:{timeView:{list:"list"}},modern:{timeView:{list:"scroll"}}},setOptions:function(t){let n=this,o=n._value,a=!!t.componentType;h.fn.setOptions.call(n,t),t=n.options,e.isPlainObject(t.interval)&&"modern"!==t.componentType&&(t.interval=30),+t.max==+q&&+t.min==+q||(this._specifiedRange=!0),n._arrow.off(g),n._arrow.remove(),$(t),t.componentType&&a&&(t.timeView.list="classic"==t.componentType?"list":"scroll",n.options.height="classic"==t.componentType?200:null,n._createTimeView(),n.timeView._value=o),n.timeView.setOptions(t),n._icon(),n._editable(t),n._createDateInput(),o&&n.element.val(i.toString(o,t.format,t.culture)),t.label&&n._inputLabel?n.label.setOptions(t.label):!1===t.label?(n.label._unwrapFloating(),n._inputLabel.remove(),delete n._inputLabel):t.label&&n._label()},dataBind:function(e){Q(e)&&this.timeView.dataBind(e)},_createDateInput:function(){const e=this,t=e.options,i=e.element;if(e._dateInput&&(e._dateInput.destroy(),e._dateInput=null),t.dateInput){var n=t.min,o=t.max,a=new z;N(n)==N(o)&&(n=new z(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0),o=new z(a.getFullYear(),a.getMonth(),a.getDate(),24,0,0)),e._dateInput=new p.DateInput(i,{autoAdjust:t.autoAdjust,culture:t.culture,format:t.format,min:n,max:o,value:t.value,interval:t.interval,size:t.size,fillMode:t.fillMode,rounded:t.rounded,messages:t.messages.dateInput,autoCorrectParts:t.autoCorrectParts,toggleDayPeriod:!0,inputMode:t.inputMode})}},_editable:function(e){var t=this,i=e.disable,n=e.readonly,o=t._arrow.off(g),a=t.element.off(g),s=t.wrapper.off(g);t._dateInput&&t._dateInput._unbindInput(),n||i?(s.addClass(i?C:"").removeClass(i?"":C),a.attr(b,i).attr(w,n).attr(P,i).attr(R,n)):(s.removeClass(C).on(M,t._toggleHover),a&&a.length&&(a[0].removeAttribute(b),a[0].removeAttribute(w)),a.attr(P,!1).attr(R,!1).on("keydown"+g,t._keydown.bind(t)).on("focusout"+g,t._blur.bind(t)).on("focus"+g,(function(){t.wrapper.addClass(y)})),t._dateInput&&t._dateInput._bindInput(),o.on(v,t._click.bind(t)).on(S,K))},_label:function(){var t=this,n=t.options,o=e.isPlainObject(n.label)?n.label:{content:n.label};t._dateInput&&(o.floatCheck=()=>!(t.value()||t._dateInput._hasDateInput()&&""!==t.element.val()||document.activeElement===t.element[0])&&(t.element.val(""),!0)),t.label=new i.ui.Label(null,e.extend({},o,{widget:t})),t._inputLabel=t.label.element},readonly:function(e){this._editable({readonly:e===t||e,disable:!1}),this.label&&this.label.floatingLabel&&this.label.floatingLabel.readonly(e===t||e)},enable:function(e){this._editable({readonly:!1,disable:!(e=e===t||e)}),this.label&&this.label.floatingLabel&&this.label.floatingLabel.enable(e=e===t||e)},destroy:function(){var e=this;h.fn.destroy.call(e),e.timeView.destroy(),e.element.off(g),e._arrow.off(g),e.wrapper.off(g),e._form&&e._form.off("reset",e._resetHandler),e.label&&e.label.destroy(),e.bigScreenMQL&&e.bigScreenMQL.destroy(),e._createTimeViewProxy=null},close:function(){this.timeView.close()},open:function(){this.timeView.open()},min:function(e){return e&&(this._specifiedRange=!0),this._option("min",e)},max:function(e){return e&&this.timeView?(this._specifiedRange=!0,this.timeView.options.maxSet=!0):this.timeView&&(this.timeView.options.maxSet=!1),this._option("max",e)},value:function(e){var i=this;if(e===t)return i._value;i._old=i._update(e),null===i._old&&i.element.val(""),i._oldText=i.element.val(),i.label&&i.label.floatingLabel&&i.label.floatingLabel.refresh()},_blur:function(){var e=this,t=e.element.val();e._typing=!1,e.options.timeView&&"scroll"===e.options.timeView.list||e.close(),t!==e._oldText&&e._change(t),e.wrapper.removeClass(y)},_click:function(){var e=this,t=e.element;e.timeView.toggle(),u.touch||t[0]===l()||e.options.timeView&&"scroll"===e.options.timeView.list||t.trigger("focus")},_change:function(e){var t,n=this,o=n.element.val();e=n._update(e);var a=(t=!i.calendar.isEqualDate(n._old,e))&&!n._typing,s=o!==n.element.val();(a||s)&&n.element.trigger(_),t&&(n._old=e,n._oldText=n.element.val(),n.trigger(_)),n._typing=!1},_createTimeView:function(){var e,t,i=this,n=i.options,o=i.element;i.timeView&&(i.timeView.popup&&i.timeView.popup.wrapper&&i.timeView.popup.wrapper.remove(),i.timeView.destroy(),i.timeView=null),i.timeView=e=new B(O({},n,{id:o.attr(A),size:"auto"!=n.adaptiveMode||i.bigScreenMQL.mediaQueryList.matches?n.size:"large",anchor:i.wrapper,format:n.format,change:function(e,t){t?i._change(e):o.val(e),i.timeView._focusTime=null},open:function(n){i.options.timeView&&"scroll"!==i.options.timeView.list?i.timeView._adjustListWidth():i.timeView._updateTitle(),i.trigger(m)?n.preventDefault():(o.attr(H,!0),t.attr(I,!1),e.current()&&o.attr(F,e._optionID))},close:function(e){i.trigger(f)?e.preventDefault():(o.attr(H,!1),t.attr(I,!0),o[0].removeAttribute(F))},active:function(t){o&&o.length&&o[0].removeAttribute(F),t&&o.attr(F,e._optionID)},specifiedRange:i._specifiedRange,maxSet:+n.max!=+q})),t=e.ul,i._ariaLabel(t)},_icon:function(){var t,i=this,n=i.element,a=i.options;(t=n.next("button.k-input-button"))[0]||(t=e(o.renderButton('<button unselectable="on" tabindex="-1" class="k-input-button" aria-label="select"></button>',{icon:"clock",size:a.size,fillMode:a.fillMode,shape:"none",rounded:"none"})).insertAfter(n)),i._arrow=t.attr({role:"button"})},_keydown:function(e){const t=this,i=e.keyCode,o=t.timeView,a=t.element.val();o.popup.visible()||e.altKey?(o.move(e),t._dateInput&&e.stopImmediatePropagation&&"modern"!==t.options.componentType&&e.stopImmediatePropagation()):i===n.ENTER&&a!==t._oldText?t._change(a):t._typing=!0},_option:function(e,i){var n=this,o=n.options;if(i===t)return o[e];(i=n.timeView._parse(i))&&(i=new z(+i),o[e]=i,n.timeView.options[e]=i,n._dateInput&&n._dateInput[e](i),n.timeView.bind())},_toggleHover:function(t){e(t.currentTarget).toggleClass(T,"mouseenter"===t.type)},_update:function(e){var t=this,n=t.options,o=t.timeView,a=o._parse(e);return Y(a,n.min,n.max)||(a=null),t._value=a,t._currentlySelected=a,t._dateInput&&a?t._dateInput.value(a||e):t.element.val(i.toString(a||e,n.format,n.culture)),o.value(a),a},_toggleMaxSet:function(e){this.timeView&&(this.timeView._ignoreMaxSet=e)},_wrapper:function(){var e,t=this.element;(e=t.parents(".k-timepicker"))[0]||(e=t.wrap("<span></span>").parent()),e[0].style.cssText=t[0].style.cssText,this.wrapper=e.addClass("k-timepicker k-input").addClass(t[0].className),t.css({height:t[0].style.height})},_reset:function(){let t=this,i=t.element,n=i.attr("form"),o=n?e("#"+n):i.closest("form");o[0]&&(t._resetHandler=function(){t._toggleMaxSet(!0),t.value(i[0].defaultValue),t.max(t._initialOptions.max),t.min(t._initialOptions.min),t._toggleMaxSet(!1)},t._form=o.on("reset",t._resetHandler))}});function $(e){var t=e.parseFormats;e.format=r(e.format||i.getCulture(e.culture).calendars.standard.patterns.t),(t=Q(t)?t:[t]).splice(0,0,e.format),e.parseFormats=t}function K(e){e.preventDefault()}function G(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function U(e,t){var i=!1;return-1!==e.indexOf(t)&&(i=!0),i}function J(e,t){for(var i=String(e);i.length<(t||2);)i="0"+i;return i}function X(e){return e.length&&e[0].getBoundingClientRect().height}i.cssProperties.registerPrefix("TimePicker","k-input-"),i.cssProperties.registerValues("TimePicker",[{prop:"rounded",values:i.cssProperties.roundedValues.concat([["full","full"]])}]),p.plugin(W)}(window.kendo.jQuery);var t=kendo;e.__meta__={id:"timepicker",name:"TimePicker",category:"web",description:"The TimePicker widget allows the end user to select a value from a list of predefined values or to type a new value.",depends:["calendar","popup","html.button","label","actionsheet"]},e.default=t,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=kendo.timepicker.min.js.map