UNPKG

@progress/kendo-ui

Version:

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

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