/** 
 * Kendo UI v2016.3.1118 (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.listview.min",["kendo.data.min","kendo.editable.min","kendo.selectable.min"],e)}(function(){return function(e,t){var a=window.kendo,n="change",i="cancel",r="dataBound",l="dataBinding",o=a.ui.Widget,s=a.keys,d=">*:not(.k-loading-mask)",c="progress",u="error",m="k-state-focused",f="k-state-selected",p="k-edit-item",g="edit",h="remove",_="save",v="click",b=".kendoListView",S=e.proxy,E=a._activeElement,w=a.ui.progress,k=a.data.DataSource,y=a.ui.DataBoundWidget.extend({init:function(t,n){var i=this;n=e.isArray(n)?{dataSource:n}:n,o.fn.init.call(i,t,n),n=i.options,i.wrapper=t=i.element,t[0].id&&(i._itemId=t[0].id+"_lv_active"),i._element(),i._dataSource(),i._templates(),i._navigatable(),i._selectable(),i._pageable(),i._crudHandlers(),i.options.autoBind&&i.dataSource.fetch(),a.notify(i)},events:[n,i,l,r,g,h,_],options:{name:"ListView",autoBind:!0,selectable:!1,navigatable:!1,template:"",altTemplate:"",editTemplate:""},setOptions:function(e){o.fn.setOptions.call(this,e),this._templates(),this.selectable&&(this.selectable.destroy(),this.selectable=null),this._selectable()},_templates:function(){var e=this.options;this.template=a.template(e.template||""),this.altTemplate=a.template(e.altTemplate||e.template),this.editTemplate=a.template(e.editTemplate||"")},_item:function(e){return this.element.children()[e]()},items:function(){return this.element.children()},dataItem:function(t){var n=a.attr("uid"),i=e(t).closest("["+n+"]").attr(n);return this.dataSource.getByUid(i)},setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.options.autoBind&&e.fetch()},_unbindDataSource:function(){var e=this;e.dataSource.unbind(n,e._refreshHandler).unbind(c,e._progressHandler).unbind(u,e._errorHandler)},_dataSource:function(){var e=this;e.dataSource&&e._refreshHandler?e._unbindDataSource():(e._refreshHandler=S(e.refresh,e),e._progressHandler=S(e._progress,e),e._errorHandler=S(e._error,e)),e.dataSource=k.create(e.options.dataSource).bind(n,e._refreshHandler).bind(c,e._progressHandler).bind(u,e._errorHandler)},_progress:function(){w(this.element,!0)},_error:function(){w(this.element,!1)},_element:function(){this.element.addClass("k-widget k-listview").attr("role","listbox")},refresh:function(e){var n,i,o,s,d,c=this,u=c.dataSource.view(),m="",f=c.template,p=c.altTemplate,g=E();if(e=e||{},"itemchange"===e.action)return c._hasBindingTarget()||c.editable||(n=e.items[0],o=c.items().filter("["+a.attr("uid")+"="+n.uid+"]"),o.length>0&&(s=o.index(),c.angular("cleanup",function(){return{elements:[o]}}),o.replaceWith(f(n)),o=c.items().eq(s),o.attr(a.attr("uid"),n.uid),c.angular("compile",function(){return{elements:[o],data:[{dataItem:n}]}}),c.trigger("itemChange",{item:o,data:n}))),t;if(!c.trigger(l,{action:e.action||"rebind",items:e.items,index:e.index})){for(c._angularItems("cleanup"),c._destroyEditable(),s=0,d=u.length;s<d;s++)m+=s%2?p(u[s]):f(u[s]);for(c.element.html(m),i=c.items(),s=0,d=u.length;s<d;s++)i.eq(s).attr(a.attr("uid"),u[s].uid).attr("role","option").attr("aria-selected","false");c.element[0]===g&&c.options.navigatable&&c.current(i.eq(0)),c._angularItems("compile"),c.trigger(r)}},_pageable:function(){var t,n,i=this,r=i.options.pageable;e.isPlainObject(r)&&(n=r.pagerId,t=e.extend({},r,{dataSource:i.dataSource,pagerId:null}),i.pager=new a.ui.Pager(e("#"+n),t))},_selectable:function(){var e,i,r=this,l=r.options.selectable,o=r.options.navigatable;l&&(e=a.ui.Selectable.parseOptions(l).multiple,r.selectable=new a.ui.Selectable(r.element,{aria:!0,multiple:e,filter:d,change:function(){r.trigger(n)}}),o&&r.element.on("keydown"+b,function(a){if(a.keyCode===s.SPACEBAR){if(i=r.current(),a.target==a.currentTarget&&a.preventDefault(),e)if(a.ctrlKey){if(i&&i.hasClass(f))return i.removeClass(f),t}else r.selectable.clear();else r.selectable.clear();r.selectable.value(i)}}))},current:function(e){var a=this,n=a.element,i=a._current,r=a._itemId;return e===t?i:(i&&i[0]&&(i[0].id===r&&i.removeAttr("id"),i.removeClass(m),n.removeAttr("aria-activedescendant")),e&&e[0]&&(r=e[0].id||r,a._scrollTo(e[0]),n.attr("aria-activedescendant",r),e.addClass(m).attr("id",r)),a._current=e,t)},_scrollTo:function(t){var a,n,i=this,r=!1,l="scroll";"auto"==i.wrapper.css("overflow")||i.wrapper.css("overflow")==l?a=i.wrapper[0]:(a=window,r=!0),n=function(n,i){var o=r?e(t).offset()[n.toLowerCase()]:t["offset"+n],s=t["client"+i],d=e(a)[l+n](),c=e(a)[i.toLowerCase()]();o+s>d+c?e(a)[l+n](o+s-c):o<d&&e(a)[l+n](o)},n("Top","Height"),n("Left","Width")},_navigatable:function(){var t=this,n=t.options.navigatable,i=t.element,r=function(a){t.current(e(a.currentTarget)),e(a.target).is(":button,a,:input,a>.k-icon,textarea")||i.focus()};n&&(t._tabindex(),i.on("focus"+b,function(){var e=t._current;e&&e.is(":visible")||(e=t._item("first")),t.current(e)}).on("focusout"+b,function(){t._current&&t._current.removeClass(m)}).on("keydown"+b,function(n){var r,l,o=n.keyCode,d=t.current(),c=e(n.target),u=!c.is(":button,textarea,a,a>.t-icon,input"),m=c.is(":text,:password"),f=a.preventDefault,g=i.find("."+p),h=E();if(!(!u&&!m&&s.ESC!=o||m&&s.ESC!=o&&s.ENTER!=o))if(s.UP===o||s.LEFT===o)d&&(d=d.prev()),t.current(d&&d[0]?d:t._item("last")),f(n);else if(s.DOWN===o||s.RIGHT===o)d&&(d=d.next()),t.current(d&&d[0]?d:t._item("first")),f(n);else if(s.PAGEUP===o)t.current(null),t.dataSource.page(t.dataSource.page()-1),f(n);else if(s.PAGEDOWN===o)t.current(null),t.dataSource.page(t.dataSource.page()+1),f(n);else if(s.HOME===o)t.current(t._item("first")),f(n);else if(s.END===o)t.current(t._item("last")),f(n);else if(s.ENTER===o)0!==g.length&&(u||m)?(r=t.items().index(g),h&&h.blur(),t.save(),l=function(){t.element.trigger("focus"),t.current(t.items().eq(r))},t.one("dataBound",l)):""!==t.options.editTemplate&&t.edit(d);else if(s.ESC===o){if(g=i.find("."+p),0===g.length)return;r=t.items().index(g),t.cancel(),t.element.trigger("focus"),t.current(t.items().eq(r))}}),i.on("mousedown"+b+" touchstart"+b,d,S(r,t)))},clearSelection:function(){var e=this;e.selectable.clear(),e.trigger(n)},select:function(a){var n=this,i=n.selectable;return a=e(a),a.length?(i.options.multiple||(i.clear(),a=a.first()),i.value(a),t):i.value()},_destroyEditable:function(){var e=this;e.editable&&(e.editable.destroy(),delete e.editable)},_modelFromElement:function(e){var t=e.attr(a.attr("uid"));return this.dataSource.getByUid(t)},_closeEditable:function(){var e,t,n,i=this,r=i.editable,l=i.template;return r&&(r.element.index()%2&&(l=i.altTemplate),i.angular("cleanup",function(){return{elements:[r.element]}}),e=i._modelFromElement(r.element),i._destroyEditable(),n=r.element.index(),r.element.replaceWith(l(e)),t=i.items().eq(n),t.attr(a.attr("uid"),e.uid),i._hasBindingTarget()&&a.bind(t,e),i.angular("compile",function(){return{elements:[t],data:[{dataItem:e}]}})),!0},edit:function(e){var t,n,i=this,r=i._modelFromElement(e),l=r.uid;i.cancel(),e=i.items().filter("["+a.attr("uid")+"="+l+"]"),n=e.index(),e.replaceWith(i.editTemplate(r)),t=i.items().eq(n).addClass(p).attr(a.attr("uid"),r.uid),i.editable=t.kendoEditable({model:r,clearContainer:!1,errorTemplate:!1,target:i}).data("kendoEditable"),i.trigger(g,{model:r,item:t})},save:function(){var e,t,a=this,n=a.editable;n&&(t=n.element,e=a._modelFromElement(t),n.end()&&!a.trigger(_,{model:e,item:t})&&(a._closeEditable(),a.dataSource.sync()))},remove:function(e){var t=this,a=t.dataSource,n=t._modelFromElement(e);t.editable&&(a.cancelChanges(t._modelFromElement(t.editable.element)),t._closeEditable()),t.trigger(h,{model:n,item:e})||(e.hide(),a.remove(n),a.sync())},add:function(){var e,t=this,a=t.dataSource,n=a.indexOf((a.view()||[])[0]);n<0&&(n=0),t.cancel(),e=a.insert(n,{}),t.edit(t.element.find("[data-uid='"+e.uid+"']"))},cancel:function(){var e,t,a=this,n=a.dataSource;a.editable&&(e=a.editable.element,t=a._modelFromElement(e),a.trigger(i,{model:t,container:e})||(n.cancelChanges(t),a._closeEditable()))},_crudHandlers:function(){var t=this,n=v+b;t.element.on(n,".k-edit-button",function(n){var i=e(this).closest("["+a.attr("uid")+"]");t.edit(i),n.preventDefault()}),t.element.on(n,".k-delete-button",function(n){var i=e(this).closest("["+a.attr("uid")+"]");t.remove(i),n.preventDefault()}),t.element.on(n,".k-update-button",function(e){t.save(),e.preventDefault()}),t.element.on(n,".k-cancel-button",function(e){t.cancel(),e.preventDefault()})},destroy:function(){var e=this;o.fn.destroy.call(e),e._unbindDataSource(),e._destroyEditable(),e.element.off(b),e.pager&&e.pager.destroy(),a.destroy(e.element)}});a.ui.plugin(y)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,a){(a||t)()});
//# sourceMappingURL=kendo.listview.min.js.map
