16 lines
10 KiB
JavaScript
16 lines
10 KiB
JavaScript
|
/**
|
||
|
* Copyright 2014 Telerik AD
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
!function(e,define){define(["./kendo.list.min","./kendo.mobile.scroller.min"],e)}(function(){return function(e,t){function n(e,t,n){for(var i,r=0,o=t.length-1;o>r;++r)i=t[r],i in e||(e[i]={}),e=e[i];e[t[o]]=n}var i=window.kendo,r=i.ui,o=r.Select,a=i.support.mobileOS,s=i._activeElement,l=i.keys,u=".kendoDropDownList",c="disabled",d="readonly",f="change",h="k-state-focused",p="k-state-default",g="k-state-disabled",m="aria-disabled",v="aria-readonly",_="k-state-selected",y="mouseenter"+u+" mouseleave"+u,b="tabindex",w="filter",x="accept",k=e.proxy,C=o.extend({init:function(n,r){var a,s,l,c=this,d=r&&r.index;c.ns=u,r=e.isArray(r)?{dataSource:r}:r,o.fn.init.call(c,n,r),c._focusHandler=function(){c.wrapper.focus()},r=c.options,n=c.element.on("focus"+u,c._focusHandler),this._inputTemplate(),c._reset(),c._prev="",c._word="",c._wrapper(),c._tabindex(),c.wrapper.data(b,c.wrapper.attr(b)),c._span(),c._popup(),c._mobile(),c._dataSource(),c._ignoreCase(),c._filterHeader(),c._aria(),c._enable(),c._oldIndex=c.selectedIndex=-1,c._cascade(),d!==t&&(r.index=d),r.autoBind?c.dataSource.fetch():-1===c.selectedIndex&&(l=r.text||"",l||(a=r.optionLabel,s=a&&0===r.index,c._isSelect?l=s?a:n.children(":selected").text():!n[0].value&&s&&(l=a)),c._textAccessor(l)),i.notify(c)},options:{name:"DropDownList",enabled:!0,autoBind:!0,index:0,text:null,value:null,template:"",valueTemplate:"",delay:500,height:200,dataTextField:"",dataValueField:"",optionLabel:"",cascadeFrom:"",cascadeFromField:"",ignoreCase:!0,animation:{},filter:"none",minLength:1},events:["open","close",f,"select","dataBinding","dataBound","cascade"],setOptions:function(e){o.fn.setOptions.call(this,e),this._template(),this._inputTemplate(),this._accessors(),this._filterHeader(),this._enable(),this._aria()},destroy:function(){var e=this;e.wrapper.off(u),e.element.off(u),e._inputWrapper.off(u),o.fn.destroy.call(e)},open:function(){var e=this;e.popup.visible()||(e.ul[0].firstChild&&e._state!==x?(e.popup.open(),e._focusElement(e.filterInput),e._scroll(e._current)):(e._open=!0,e._state="rebind",e.filterInput&&e.filterInput.val(""),e._filterSource()))},toggle:function(e){this._toggle(e,!0)},refresh:function(){var t,n,r=this,o=r._data(),a=o.length,s=r.options.optionLabel,l=r._state===w,u=r.element[0];r.trigger("dataBinding"),r._current&&r.current(null),r._angularItems("cleanup"),r.ul[0].innerHTML=i.render(r.template,o),r._angularItems("compile"),r._height(l?a||1:a),r.popup.visible()&&r.popup._position(),r._isSelect&&(t=u.selectedIndex,n=r.value(),a?s&&(s=r._option("",r._optionLabelText(s))):n&&(t=0,s=r._option(n,r.text())),r._options(o,s),u.selectedIndex=-1===t?0:t),r._hideBusy(),r._makeUnselectable(),l?r.current(e(r.ul[0].firstChild)):(r._open&&r.toggle(!!a),r._open=!1,r._fetch||(a?r._selectItem():r._textAccessor()!==s&&(r.element.val(""),r._textAccessor("")))),r._bound=!!a,r.trigger("dataBound")},text:function(e){var n,i,r=this,o=r.options.ignoreCase;return e=null===e?"":e,e===t?r._textAccessor():("string"==typeof e&&(i=o?e.toLowerCase():e,n=r._select(function(e){return e=r._text(e),o&&(e=(e+"").toLowerCase()),e===i}),n&&(e=n)),r._textAccessor(e),t)},value:function(e){var n,i,r=this;return e===t?r._accessor():(null!==e&&(e=""+e),r._selectedValue=e,i=e||r.options.optionLabel&&!r.element[0].disabled&&""===e,i&&r._fetchItems(e)||(n=r._index(e),r.select(n>-1?n:0)),t)},_editable:function(e){var t=this,n=t.element,r=e.disable,o=e.readonly,a=t.wrapper.add(t.filterInput).off(u),s=t._inputWrapper.off(y),l=function(){s.addClass(h),t._prevent=!1},f=function(){var e,r;t._prevent||(e=t._state===w,r=window.self!==window.top,e&&t._select(t._current),(!e||t.dataItem())&&t._triggerCascade(),i.support.mobileOS.ios&&r?t._change():t._blur(),s.removeClass(h),t._prevent=!0,t._open=!1,n.blur()),t._wrapperClicked=!1};o||r?r?(a.removeAttr(b),s.addClass(g).removeClass(p)):(s.addClass(p).removeClass(g),a.on("focusin"+u,l).on("focusout"+u,f)):(n.removeAttr(c).removeAttr(d),s.addClass(p).removeClass(g).on(y,t._toggleHover),a.attr(b,a.data(b)).attr(m,!1).attr(v,!1).on("keydown"+u,k(t._keydown,t)).on("focusin"+u,l).on("foc
|