16 lines
13 KiB
JavaScript
16 lines
13 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){var n;if(null===e&&null!==t||null!==e&&null===t)return!1;if(n=e.length,n!==t.length)return!1;for(;n--;)if(e[n]!==t[n])return!1;return!0}function i(t){var n=t.firstChild;return n&&"none"===n.style.display&&(n=o(n,x)),n?e(n):n}function r(t){var n=t.lastChild;return n&&"none"===n.style.display&&(n=o(n,k)),n?e(n):n}function o(e,t){return e=e[t],e&&"none"===e.style.display&&(e=o(e,t)),e}var a=window.kendo,s=a.ui,l=s.List,u=a.keys,c=a._activeElement,d=a.data.ObservableArray,f=e.proxy,h="id",p="li",g="accept",m="filter",v="open",_="close",y="change",b="progress",w="select",x="nextSibling",k="previousSibling",C=' style="display:none"',T="aria-disabled",S="aria-readonly",F="k-state-focused",D="k-loading-hidden",M="k-state-hover",E="k-state-disabled",O="disabled",A="readonly",z=".kendoMultiSelect",I="click"+z,P="keydown"+z,H="mouseenter"+z,N="mouseleave"+z,L=H+" "+N,B=/"/g,R=e.isArray,W=["font-family","font-size","font-stretch","font-style","font-weight","letter-spacing","text-transform","line-height"],q=l.extend({init:function(t,n){var i,r,o=this;o.ns=z,l.fn.init.call(o,t,n),o._wrapper(),o._tagList(),o._input(),o._textContainer(),o._loader(),o._tabindex(o.input),t=o.element.attr("multiple","multiple").hide(),n=o.options,r=n.value,n.placeholder||(n.placeholder=t.data("placeholder")),i=t.attr(h),i&&(o._tagID=i+"_tag_active",i+="_taglist",o.tagList.attr(h,i)),o._aria(i),o._dataSource(),o._ignoreCase(),o._popup(),o._values=[],o._dataItems=[],o._reset(),o._enable(),o._placeholder(),n.autoBind?o.dataSource.fetch():r&&(R(r)||(r=[r]),(e.isPlainObject(r[0])||!n.dataValueField)&&(o._retrieveData=!0,o.dataSource.data(r),o.value(o._initialValues))),a.notify(o)},options:{name:"MultiSelect",enabled:!0,autoBind:!0,autoClose:!0,highlightFirst:!0,dataTextField:"",dataValueField:"",filter:"startswith",ignoreCase:!0,minLength:0,delay:100,value:null,maxSelectedItems:null,itemTemplate:"",tagTemplate:"",placeholder:"",height:200,animation:{}},events:[v,_,y,w,"dataBinding","dataBound"],setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.options.autoBind&&this.dataSource.fetch()},setOptions:function(e){l.fn.setOptions.call(this,e),this._template(),this._accessors(),this._aria(this.tagList.attr(h))},current:function(e){return this.currentTag(null),l.fn.current.call(this,e)},currentTag:function(e){var n=this;return e===t?n._currentTag:(n._currentTag&&(n._currentTag.removeClass(F).removeAttr(h),n.input.removeAttr("aria-activedescendant")),e&&(e.addClass(F).attr(h,n._tagID),n.input.attr("aria-activedescendant",n._tagID)),n._currentTag=e,t)},dataItems:function(){return this._dataItems},destroy:function(){var e=this,t=e.ns;e.wrapper.off(t),e.tagList.off(t),e.input.off(t),l.fn.destroy.call(e)},_editable:function(t){var n=this,i=t.disable,r=t.readonly,o=n.wrapper.off(z),a=n.tagList.off(z),s=n.element.add(n.input.off(z));r||i?(i?o.addClass(E):o.removeClass(E),s.attr(O,i).attr(A,r).attr(T,i).attr(S,r)):(o.removeClass(E).on(L,n._toggleHover).on("mousedown"+z,function(e){var t="input"!==e.target.nodeName.toLowerCase();t&&e.preventDefault(),-1===e.target.className.indexOf("k-delete")&&(n.input[0]!==c()&&t&&n.input.focus(),0===n.options.minLength&&n.open())}),n.input.on(P,f(n._keydown,n)).on("paste"+z,f(n._search,n)).on("focus"+z,function(){n._placeholder(!1),o.addClass(F)}).on("focusout"+z,function(){clearTimeout(n._typing),o.removeClass(F),n._placeholder(!n._dataItems[0],!0),n.close(),n._state===m&&(n._state=g),n.element.blur()}),s.removeAttr(O).removeAttr(A).attr(T,!1).attr(S,!1),a.on(H,p,function(){e(this).addClass(M)}).on(N,p,function(){e(this).removeClass(M)}).on(I,".k-delete",function(t){n._unselect(e(t.target).closest(p)),n._change(),n.close()}))},_close:function(){var e=this;e.options.autoClose||!e._visibleItems?e.close():(e.current(e.options.highlightFirst?i(e.ul[0]):null),e.popup._position())},close:function(){this.popup.close(),this.current(null)},open:function(){var e=this;e._request&&(e._retrieveData=
|