/** * Kendo UI v2016.1.112 (http://www.telerik.com/kendo-ui) * Copyright 2016 Telerik AD. All rights reserved. * * Kendo UI commercial licenses may be obtained at * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete * If you do not own a commercial license, this file shall be governed by the trial license terms. */ !function(e,define){define("kendo.dropdownlist.min",["kendo.list.min","kendo.mobile.scroller.min"],e)}(function(){return function(e,t){function i(e,t,i){for(var n,s=0,o=t.length-1;o>s;++s)n=t[s],n in e||(e[n]={}),e=e[n];e[t[o]]=i}function n(e,t){return e>=t&&(e-=t),e}function s(e,t){for(var i=0;e.length>i;i++)if(e.charAt(i)!==t)return!1;return!0}var o=window.kendo,a=o.ui,l=a.Select,r=o.support,p=o._activeElement,u=o.data.ObservableObject,c=o.keys,d=".kendoDropDownList",f="disabled",_="readonly",h="change",m="k-state-focused",b="k-state-default",v="k-state-disabled",w="aria-disabled",g="aria-readonly",x="mouseenter"+d+" mouseleave"+d,L="tabindex",I="filter",k="accept",y="The `optionLabel` option is not valid due to missing fields. Define a custom optionLabel as shown here http://docs.telerik.com/kendo-ui/api/javascript/ui/dropdownlist#configuration-optionLabel",T=e.proxy,C=l.extend({init:function(i,n){var s,a,r,p=this,u=n&&n.index;p.ns=d,n=e.isArray(n)?{dataSource:n}:n,l.fn.init.call(p,i,n),n=p.options,i=p.element.on("focus"+d,T(p._focusHandler,p)),p._focusInputHandler=e.proxy(p._focusInput,p),p.optionLabel=e(),p._optionLabel(),p._inputTemplate(),p._reset(),p._prev="",p._word="",p._wrapper(),p._tabindex(),p.wrapper.data(L,p.wrapper.attr(L)),p._span(),p._popup(),p._mobile(),p._dataSource(),p._ignoreCase(),p._filterHeader(),p._aria(),p._enable(),p._oldIndex=p.selectedIndex=-1,u!==t&&(n.index=u),p._initialIndex=n.index,p._initList(),p._cascade(),n.autoBind?p.dataSource.fetch():-1===p.selectedIndex&&(a=n.text||"",a||(s=n.optionLabel,s&&0===n.index?a=s:p._isSelect&&(a=i.children(":selected").text())),p._textAccessor(a)),r=e(p.element).parents("fieldset").is(":disabled"),r&&p.enable(!1),p.listView.bind("click",function(e){e.preventDefault()}),o.notify(p)},options:{name:"DropDownList",enabled:!0,autoBind:!0,index:0,text:null,value:null,delay:500,height:200,dataTextField:"",dataValueField:"",optionLabel:"",cascadeFrom:"",cascadeFromField:"",ignoreCase:!0,animation:{},filter:"none",minLength:1,virtual:!1,template:null,valueTemplate:null,optionLabelTemplate:null,groupTemplate:"#:data#",fixedGroupTemplate:"#:data#"},events:["open","close",h,"select","filtering","dataBinding","dataBound","cascade"],setOptions:function(e){l.fn.setOptions.call(this,e),this.listView.setOptions(this._listOptions(e)),this._optionLabel(),this._inputTemplate(),this._accessors(),this._filterHeader(),this._enable(),this._aria(),!this.value()&&this.hasOptionLabel()&&this.select(0)},destroy:function(){var e=this;l.fn.destroy.call(e),e.wrapper.off(d),e.element.off(d),e._inputWrapper.off(d),e._arrow.off(),e._arrow=null,e.optionLabel.off()},open:function(){var e=this;e.popup.visible()||(e.listView.bound()&&e._state!==k?e._allowOpening()&&(e.popup.one("activate",e._focusInputHandler),e.popup.open(),e._focusItem()):(e._open=!0,e._state="rebind",e.filterInput&&(e.filterInput.val(""),e._prev=""),e._filterSource()))},_focusInput:function(){this._focusElement(this.filterInput)},_allowOpening:function(){return this.hasOptionLabel()||this.filterInput||this.dataSource.view().length},toggle:function(e){this._toggle(e,!0)},current:function(e){var i;return e===t?(i=this.listView.focus(),!i&&0===this.selectedIndex&&this.hasOptionLabel()?this.optionLabel:i):(this._focus(e),t)},dataItem:function(i){var n=this,s=null;if(null===i)return i;if(i===t)s=n.listView.selectedDataItems()[0];else{if("number"!=typeof i){if(n.options.virtual)return n.dataSource.getByUid(e(i).data("uid"));i=i.hasClass("k-list-optionlabel")?-1:e(n.items()).index(i)}else n.hasOptionLabel()&&(i-=1);s=n.dataSource.flatView()[i]}return s||(s=n._optionLabelDataItem()),s},refresh:function(){this.listView.refresh()},text:function(e){var i,n,s=this,o=s.options.ignoreCase;return e=null===e?"":e,e===t?s._textAccessor():("string"==typeof e&&(n=o?e.toLowerCase():e,s._select(function(e){return e=s._text(e),o&&(e=(e+"").toLowerCase()),e===n}),i=s.dataItem(),i&&(e=i)),s._textAccessor(e),t)},value:function(e){var i=this,n=i.listView,s=i.dataSource;return e===t?(e=i._accessor()||i.listView.value()[0],e===t||null===e?"":e):(e&&(i._initialIndex=null),i._request&&i.options.cascadeFrom&&i.listView.bound()?(i._valueSetter&&s.unbind(h,i._valueSetter),i._valueSetter=T(function(){i.value(e)},i),s.one(h,i._valueSetter),t):(n.bound()&&n.isFiltered()?(n.bound(!1),i._filterSource()):i._fetchData(),n.value(e).done(function(){-1===i.selectedIndex&&i.text()&&(i.text(""),i._accessor("",-1)),i._old=i._accessor(),i._oldIndex=i.selectedIndex}),t))},hasOptionLabel:function(){return this.optionLabel&&!!this.optionLabel[0]},_optionLabel:function(){var i=this,n=i.options,s=n.optionLabel,a=n.optionLabelTemplate;return s?(a||(a="#:",a+="string"==typeof s?"data":o.expr(n.dataTextField,"data"),a+="#"),"function"!=typeof a&&(a=o.template(a)),i.optionLabelTemplate=a,i.hasOptionLabel()||(i.optionLabel=e('
').prependTo(i.list)),i.optionLabel.html(a(s)).off().click(T(i._click,i)).on(x,i._toggleHover),i.angular("compile",function(){return{elements:i.optionLabel}}),t):(i.optionLabel.off().remove(),i.optionLabel=e(),t)},_optionLabelText:function(){var e=this.options.optionLabel;return"string"==typeof e?e:this._text(e)},_optionLabelDataItem:function(){var t=this,i=t.options.optionLabel;return t.hasOptionLabel()?e.isPlainObject(i)?new u(i):t._assignInstance(t._optionLabelText(),""):null},_listBound:function(){var e,t,i=this,n=i._initialIndex,s=i.options.optionLabel,o=i._state===I,a=i.dataSource.flatView(),l=a.length;i._angularItems("compile"),i._presetValue=!1,i._resizePopup(!0),i.popup.position(),i._isSelect&&(t=i.value(),l?s&&(s=i._option("",i._optionLabelText())):t&&(s=i._option(t,i.text())),i._options(a,s,t)),i._makeUnselectable(),o||(i._open&&i.toggle(i._allowOpening()),i._open=!1,i._fetch||(l?(!i.listView.value().length&&n>-1&&null!==n&&i.select(n),i._initialIndex=null,e=i.listView.selectedDataItems()[0],e&&i.text()!==i._text(e)&&i._selectValue(e)):i._textAccessor()!==i._optionLabelText()&&(i.listView.value(""),i._selectValue(null),i._oldIndex=i.selectedIndex))),i._hideBusy(),i.trigger("dataBound")},_listChange:function(){this._selectValue(this.listView.selectedDataItems()[0]),(this._presetValue||this._old&&-1===this._oldIndex)&&(this._oldIndex=this.selectedIndex)},_focusHandler:function(){this.wrapper.focus()},_focusinHandler:function(){this._inputWrapper.addClass(m),this._prevent=!1},_focusoutHandler:function(){var e=this,t=e._state===I,i=window.self!==window.top,n=e._focus();e._prevent||(clearTimeout(e._typingTimeout),t&&n&&!e.trigger("select",{item:n})&&e._select(n,!e.dataSource.view().length),r.mobileOS.ios&&i?e._change():e._blur(),e._inputWrapper.removeClass(m),e._prevent=!0,e._open=!1,e.element.blur())},_wrapperMousedown:function(){this._prevent=!!this.filterInput},_wrapperClick:function(e){e.preventDefault(),this.popup.unbind("activate",this._focusInputHandler),this._focused=this.wrapper,this._toggle()},_editable:function(e){var t=this,i=t.element,n=e.disable,s=e.readonly,o=t.wrapper.add(t.filterInput).off(d),a=t._inputWrapper.off(x);s||n?n?(o.removeAttr(L),a.addClass(v).removeClass(b)):(a.addClass(b).removeClass(v),o.on("focusin"+d,T(t._focusinHandler,t)).on("focusout"+d,T(t._focusoutHandler,t))):(i.removeAttr(f).removeAttr(_),a.addClass(b).removeClass(v).on(x,t._toggleHover),o.attr(L,o.data(L)).attr(w,!1).attr(g,!1).on("keydown"+d,T(t._keydown,t)).on("focusin"+d,T(t._focusinHandler,t)).on("focusout"+d,T(t._focusoutHandler,t)).on("mousedown"+d,T(t._wrapperMousedown,t)),t.wrapper.on("click"+d,T(t._wrapperClick,t)),t.filterInput||o.on("keypress"+d,T(t._keypress,t))),i.attr(f,n).attr(_,s),o.attr(w,n).attr(g,s)},_option:function(e,t){return'"},_keydown:function(e){var i,n,s=this,o=e.keyCode,a=e.altKey,l=s.popup.visible();if(s.filterInput&&(i=s.filterInput[0]===p()),o===c.LEFT?(o=c.UP,n=!0):o===c.RIGHT&&(o=c.DOWN,n=!0),!n||!i){if(e.keyCode=o,(a&&o===c.UP||o===c.ESC)&&s._focusElement(s.wrapper),o===c.ENTER&&s._typingTimeout&&s.filterInput&&l)return e.preventDefault(),t;n=s._move(e),n||(l&&s.filterInput||(o===c.HOME?(n=!0,s._firstItem()):o===c.END&&(n=!0,s._lastItem()),n&&(s._select(s._focus()),e.preventDefault())),a||n||!s.filterInput||s._search())}},_matchText:function(e,i){var n=this.options.ignoreCase;return e===t||null===e?!1:(e+="",n&&(e=e.toLowerCase()),0===e.indexOf(i))},_shuffleData:function(e,t){var i=this._optionLabelDataItem();return i&&(e=[i].concat(e)),e.slice(t).concat(e.slice(0,t))},_selectNext:function(){var e,t,i,o=this,a=o.dataSource.flatView().toJSON(),l=a.length+(o.hasOptionLabel()?1:0),r=s(o._word,o._last),p=o.selectedIndex;for(-1===p?p=0:(p+=r?1:0,p=n(p,l)),a=o._shuffleData(a,p),i=0;l>i&&(t=o._text(a[i]),!r||!o._matchText(t,o._last))&&!o._matchText(t,o._word);i++);i!==l&&(e=o._focus(),o._select(n(p+i,l)),o.trigger("select",{item:o._focus()})&&o._select(e),o.popup.visible()||o._change())},_keypress:function(e){var t,i=this;0!==e.which&&e.keyCode!==o.keys.ENTER&&(t=String.fromCharCode(e.charCode||e.keyCode),i.options.ignoreCase&&(t=t.toLowerCase())," "===t&&e.preventDefault(),i._word+=t,i._last=t,i._search())},_popupOpen:function(){var e=this.popup;e.wrapper=o.wrap(e.element),e.element.closest(".km-root")[0]&&(e.wrapper.addClass("km-popup km-widget"),this.wrapper.addClass("km-widget"))},_popup:function(){l.fn._popup.call(this),this.popup.one("open",T(this._popupOpen,this))},_click:function(i){var n=i.item||e(i.currentTarget);return i.preventDefault(),this.trigger("select",{item:n})?(this.close(),t):(this._userTriggered=!0,this._select(n),this._focusElement(this.wrapper),this._blur(),t)},_focusElement:function(e){var t=p(),i=this.wrapper,n=this.filterInput,s=e===n?i:n,o=r.mobileOS&&(r.touch||r.MSPointers||r.pointers);n&&n[0]===e[0]&&o||n&&s[0]===t&&(this._prevent=!0,this._focused=e.focus())},_filter:function(e){var t,i;e&&(t=this,i=t.options.ignoreCase,i&&(e=e.toLowerCase()),t._select(function(i){return t._matchText(t._text(i),e)}))},_search:function(){var e=this,i=e.dataSource;if(clearTimeout(e._typingTimeout),"none"!==e.options.filter)e._typingTimeout=setTimeout(function(){var t=e.filterInput.val();e._prev!==t&&(e._prev=t,e.search(t)),e._typingTimeout=null},e.options.delay);else{if(e._typingTimeout=setTimeout(function(){e._word=""},e.options.delay),!e.listView.bound())return i.fetch().done(function(){e._selectNext()}),t;e._selectNext()}},_get:function(t){var i,n,s,o="function"==typeof t,a=o?e():e(t);if(this.hasOptionLabel()&&("number"==typeof t?t>-1&&(t-=1):a.hasClass("k-list-optionlabel")&&(t=-1)),o){for(i=this.dataSource.flatView(),s=0;i.length>s;s++)if(t(i[s])){t=s,n=!0;break}n||(t=-1)}return t},_firstItem:function(){this.hasOptionLabel()?this._focus(this.optionLabel):this.listView.focusFirst()},_lastItem:function(){this._resetOptionLabel(),this.listView.focusLast()},_nextItem:function(){this.optionLabel.hasClass("k-state-focused")?(this._resetOptionLabel(),this.listView.focusFirst()):this.listView.focusNext()},_prevItem:function(){this.optionLabel.hasClass("k-state-focused")||(this.listView.focusPrev(),this.listView.focus()||this._focus(this.optionLabel))},_focusItem:function(){var e=this.listView,i=e.focus(),n=e.select();n=n[n.length-1],n===t&&this.options.highlightFirst&&!i&&(n=0),n!==t?e.focus(n):this.options.optionLabel?(this._focus(this.optionLabel),this._select(this.optionLabel)):e.scrollToIndex(0)},_resetOptionLabel:function(e){this.optionLabel.removeClass("k-state-focused"+(e||"")).removeAttr("id")},_focus:function(e){var i=this.listView,n=this.optionLabel;return e===t?(e=i.focus(),!e&&n.hasClass("k-state-focused")&&(e=n),e):(this._resetOptionLabel(),e=this._get(e),i.focus(e),-1===e&&(n.addClass("k-state-focused").attr("id",i._optionID),this._focused.add(this.filterInput).removeAttr("aria-activedescendant").attr("aria-activedescendant",i._optionID)),t)},_select:function(e,t){var i=this;e=i._get(e),i.listView.select(e),t||i._state!==I||(i._state=k),-1===e&&i._selectValue(null)},_selectValue:function(e){var i=this,n=i.options.optionLabel,s=i.listView.select(),o="",a="";s=s[s.length-1],s===t&&(s=-1),this._resetOptionLabel(" k-state-selected"),e?(a=e,o=i._dataValue(e),n&&(s+=1)):n&&(i._focus(i.optionLabel.addClass("k-state-selected")),a=i._optionLabelText(),o="string"==typeof n?"":i._value(n),s=0),i.selectedIndex=s,null===o&&(o=""),i._textAccessor(a),i._accessor(o,s),i._triggerCascade()},_mobile:function(){var e=this,t=e.popup,i=r.mobileOS,n=t.element.parents(".km-root").eq(0);n.length&&i&&(t.options.animation.open.effects=i.android||i.meego?"fadeIn":i.ios||i.wp?"slideIn:up":t.options.animation.open.effects)},_filterHeader:function(){var t,i=this.options,n="none"!==i.filter;this.filterInput&&(this.filterInput.off(d).parent().remove(),this.filterInput=null),n&&(t=' ',this.filterInput=e('').attr({placeholder:this.element.attr("placeholder"),role:"listbox","aria-haspopup":!0,"aria-expanded":!1}),this.list.prepend(e('').append(this.filterInput.add(t))))},_span:function(){var t,i=this,n=i.wrapper,s="span.k-input";t=n.find(s),t[0]||(n.append(' ').append(i.element),t=n.find(s)),i.span=t,i._inputWrapper=e(n[0].firstChild),i._arrow=n.find(".k-icon")},_wrapper:function(){var e,t=this,i=t.element,n=i[0];e=i.parent(),e.is("span.k-widget")||(e=i.wrap("").parent(),e[0].style.cssText=n.style.cssText,e[0].title=n.title),i.hide(),t._focused=t.wrapper=e.addClass("k-widget k-dropdown k-header").addClass(n.className).css("display","").attr({accesskey:i.attr("accesskey"),unselectable:"on",role:"listbox","aria-haspopup":!0,"aria-expanded":!1})},_clearSelection:function(e){this.select(e.value()?0:-1)},_inputTemplate:function(){var t=this,i=t.options.valueTemplate;if(i=i?o.template(i):e.proxy(o.template("#:this._text(data)#",{useWithBlock:!1}),t),t.valueTemplate=i,t.hasOptionLabel())try{t.valueTemplate(t._optionLabelDataItem())}catch(n){throw Error(y)}},_textAccessor:function(i){var n,s=null,o=this.valueTemplate,a=this.options,l=a.optionLabel,r=this.span;if(i===t)return r.text();e.isPlainObject(i)||i instanceof u?s=i:l&&this._optionLabelText()===i&&(s=l,o=this.optionLabelTemplate),s||(s=this._assignInstance(i,this._accessor())),n=function(){return{elements:r.get(),data:[{dataItem:s}]}},this.angular("cleanup",n);try{r.html(o(s))}catch(p){r.html("")}this.angular("compile",n)},_preselect:function(e,t){e||t||(t=this._optionLabelText()),this._accessor(e),this._textAccessor(t),this._old=this._accessor(),this._oldIndex=this.selectedIndex,this.listView.setValue(e),this._initialIndex=null,this._presetValue=!0},_assignInstance:function(e,t){var n=this.options.dataTextField,s={};return n?(i(s,n.split("."),e),i(s,this.options.dataValueField.split("."),t),s=new u(s)):s=e,s}});a.plugin(C)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}); //# sourceMappingURL=kendo.dropdownlist.min.js.map