Jonathan Ouellette 580e90f6a2 initial add
2022-09-27 14:10:30 -07:00

10 lines
8.1 KiB
JavaScript

/*
* Kendo UI Complete v2013.3.1119 (http://kendoui.com)
* Copyright 2013 Telerik AD. All rights reserved.
*
* Kendo UI Complete commercial licenses may be obtained at
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-complete-commercial.aspx
* If you do not own a commercial license, this file shall be governed by the trial license terms.
*/
!function(define){return define(["./kendo.list.min","./kendo.mobile.scroller.min"],function(){!function(e,t){function n(e,t,n){for(var a,o=0,s=t.length-1;s>o;++o)a=t[o],a in e||(e[a]={}),e=e[a];e[t[s]]=n}var a=window.kendo,o=a.ui,s=o.Select,i=a.support.mobileOS,r=".kendoDropDownList",l="disabled",c="readonly",p="change",d="k-state-focused",u="k-state-default",_="k-state-disabled",f="aria-disabled",h="aria-readonly",v="k-state-selected",m="mouseenter"+r+" mouseleave"+r,x="tabindex",g=e.proxy,b=s.extend({init:function(n,o){var i,l,c,p=this,d=o&&o.index;p.ns=r,o=e.isArray(o)?{dataSource:o}:o,s.fn.init.call(p,n,o),p._focusHandler=function(){p.wrapper.focus()},o=p.options,n=p.element.on("focus"+r,p._focusHandler),this._inputTemplate(),p._reset(),p._word="",p._wrapper(),p._tabindex(),p.wrapper.data(x,p.wrapper.attr(x)),p._aria(),p._span(),p._popup(),p._mobile(),p._dataSource(),p._ignoreCase(),p._enable(),p._oldIndex=p.selectedIndex=-1,p._cascade(),d!==t&&(o.index=d),o.autoBind?p.dataSource.fetch():-1===p.selectedIndex&&(c=o.text||"",c||(i=o.optionLabel,l=i&&0===o.index,p._isSelect?c=l?i:n.children(":selected").text():!n[0].value&&l&&(c=i)),p._textAccessor(c)),a.notify(p)},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:{}},events:["open","close",p,"select","dataBinding","dataBound","cascade"],setOptions:function(e){s.fn.setOptions.call(this,e),this._template(),this._inputTemplate(),this._accessors(),this._aria()},destroy:function(){var e=this;e.wrapper.off(r),e.element.off(r),e._inputWrapper.off(r),s.fn.destroy.call(e)},open:function(){var e=this;e.ul[0].firstChild?(e.popup.open(),e._scroll(e._current)):(e._open=!0,e._request||e.dataSource.fetch())},toggle:function(e){this._toggle(e)},refresh:function(){var e=this,t=e._data(),n=t.length,o=e.options.optionLabel;e.trigger("dataBinding"),e._current&&e.current(null),e.ul[0].innerHTML=a.render(e.template,t),e._height(n),e.popup.visible()&&e.popup._position(),e._isSelect&&(o&&n&&(o=e._optionLabelText(o),o='<option value="">'+o+"</option>"),e._options(t,o)),e._open&&(e._open=!1,e.toggle(!!n)),e._hideBusy(),e._makeUnselectable(),e._fetch||(n?e._selectItem():e._textAccessor()!==o&&(e.element.val(""),e._textAccessor(""))),e._bound=!!n,e.trigger("dataBound")},search:function(e){if(e){var n=this,a=n.options.ignoreCase;a&&(e=e.toLowerCase()),n._select(function(o){var s=n._text(o);return s!==t?(s+="",a&&(s=s.toLowerCase()),0===s.indexOf(e)):t})}},text:function(e){var n,a,o=this,s=o.options.ignoreCase;return e=null===e?"":e,e===t?o._textAccessor():("string"==typeof e&&(a=s?e.toLowerCase():e,n=o._select(function(e){return e=o._text(e),s&&(e=(e+"").toLowerCase()),e===a}),n&&(e=n)),o._textAccessor(e),t)},value:function(e){var n,a,o=this;return e===t?o._accessor():(null!==e&&(e=""+e),o._selectedValue=e,a=e||o.options.optionLabel&&!o.element[0].disabled&&""===e,a&&o._fetchItems(e)||(n=o._index(e),o.select(n>-1?n:0)),t)},_editable:function(e){var t=this,n=t.element,o=e.disable,s=e.readonly,i=t.wrapper.off(r),p=t._inputWrapper.off(m),v=function(){p.addClass(d),t._blured=!1},b=function(){if(!t._blured){t._triggerCascade();var e=window.self!==window.top;a.support.mobileOS.ios&&e?t._change():t._blur(),p.removeClass(d),t._blured=!0,n.blur()}};s||o?(o?(i.removeAttr(x),p.addClass(_).removeClass(u)):(p.addClass(u).removeClass(_),i.on("focusin"+r,v).on("focusout"+r,b)),n.attr(l,o).attr(c,s),i.attr(f,o).attr(h,s)):(n.removeAttr(l).removeAttr(c),p.addClass(u).removeClass(_).on(m,t._toggleHover),i.attr(x,i.data(x)).attr(f,!1).attr(h,!1).on("click"+r,function(e){t._blured=!1,e.preventDefault(),t.toggle()}).on("keydown"+r,g(t._keydown,t)).on("keypress"+r,g(t._keypress,t)).on("focusin"+r,v).on("focusout"+r,b))},_accept:function(e){this._focus(e)},_optionLabelText:function(){var e=this.options,t=e.dataTextField,n=e.optionLabel;return n&&t&&"object"==typeof n?this._text(n):n},_data:function(){var e=this,t=e.options,o=t.optionLabel,s=t.dataTextField,i=t.dataValueField,r=e.dataSource.view(),l=r.length,c=o,p=0;if(o&&l){for("object"==typeof o?c=o:s&&(c={},s=s.split("."),i=i.split("."),n(c,i,""),n(c,s,o)),c=new a.data.ObservableArray([c]);l>p;p++)c.push(r[p]);r=c}return r},_keydown:function(e){var t=this,n=e.keyCode,o=a.keys,s=t.ul[0];n===o.LEFT?n=o.UP:n===o.RIGHT&&(n=o.DOWN),e.keyCode=n,t._move(e),n===o.HOME?(e.preventDefault(),t._select(s.firstChild)):n===o.END&&(e.preventDefault(),t._select(s.lastChild))},_selectNext:function(e,n){for(var a,o=this,s=n,i=o._data(),r=i.length,l=o.options.ignoreCase,c=function(n,a){return n+="",l&&(n=n.toLowerCase()),0===n.indexOf(e)?(o._select(a),o._triggerEvents(),!0):t};r>n;n++)if(a=o._text(i[n]),a&&c(a,n))return!0;if(s>0)for(n=0;s>=n;n++)if(a=o._text(i[n]),a&&c(a,n))return!0;return!1},_keypress:function(e){if(0!==e.charCode){var t=this,n=String.fromCharCode(e.charCode||e.keyCode),a=t.selectedIndex,o=t._word;t.options.ignoreCase&&(n=n.toLowerCase())," "===n&&e.preventDefault(),t._last===n&&o.length<=1&&a>-1&&(o||(o=n),t._selectNext(o,a+1))||(t._word=o+n,t._last=n,t._search())}},_popup:function(){s.fn._popup.call(this),this.popup.one("open",function(){this.wrapper=a.wrap(this.element).addClass("km-popup")})},_search:function(){var e=this,n=e.dataSource,a=e.selectedIndex,o=e._word;return clearTimeout(e._typing),e._typing=setTimeout(function(){e._word=""},e.options.delay),e.ul[0].firstChild?(e._selectNext(o,a),e._triggerEvents(),t):(n.one(p,function(){n.data()[0]&&e._selectNext(o,a)}).fetch(),t)},_select:function(e){var n,a,s=this,i=s._current,r=null;return e=s._get(e),e&&e[0]&&!e.hasClass(v)&&(i&&i.removeClass(v),a=o.List.inArray(e[0],s.ul[0]),a>-1&&(r=s._data()[a],n=s._value(r),s.selectedIndex=a,s._textAccessor(r),s._accessor(n!==t?n:s._text(r),a),s._selectedValue=s._accessor(),s.current(e.addClass(v)),s._optionID&&s._current.attr("aria-selected",!0))),r},_triggerEvents:function(){this.popup.visible()||(this._triggerCascade(),this._change())},_mobile:function(){var e=this,t=e.popup,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)},_span:function(){var t,n=this,a=n.wrapper,o="span.k-input";t=a.find(o),t[0]||(a.append('<span unselectable="on" class="k-dropdown-wrap k-state-default"><span unselectable="on" class="k-input">&nbsp;</span><span unselectable="on" class="k-select"><span unselectable="on" class="k-icon k-i-arrow-s">select</span></span></span>').append(n.element),t=a.find(o)),n.span=t,n._inputWrapper=e(a[0].firstChild),n._arrow=a.find(".k-icon").mousedown(function(e){e.preventDefault()})},_wrapper:function(){var e,t=this,n=t.element,a=n[0];e=n.parent(),e.is("span.k-widget")||(e=n.wrap("<span />").parent(),e[0].style.cssText=a.style.cssText),n.hide(),t._focused=t.wrapper=e.addClass("k-widget k-dropdown k-header").addClass(a.className).css("display","").attr({unselectable:"on",role:"listbox","aria-haspopup":!0,"aria-expanded":!1})},_clearSelection:function(){var e=this,n=e.options.optionLabel;return e.dataSource.view()[0]&&n?(e.select(0),t):(e.selectedIndex=-1,e.element.val(""),e._textAccessor(n),t)},_inputTemplate:function(){var t=this,n=t.options.valueTemplate;n=n?a.template(n):e.proxy(a.template("#:this._text(data)#"),t),t.valueTemplate=n},_textAccessor:function(n){var o=this.dataItem(),s=this.span;return n===t?s.text():(e.isPlainObject(n)||n instanceof a.data.ObservableObject?o=n:o&&this._text(o)===n||(this.options.dataTextField?(o={},o[this.options.dataTextField]=n,o[this.options.dataValueField]=this._accessor()):o=n),s.html(this.valueTemplate(o)),t)}});o.plugin(b)}(window.kendo.jQuery)})}("function"==typeof define&&define.amd?define:function(e,t){return t()});
//@ sourceMappingURL=kendo.dropdownlist.min.js.map