vendor/assets/javascripts/kendo/kendo.columnmenu.min.js in kendoui-rails-0.0.9 vs vendor/assets/javascripts/kendo/kendo.columnmenu.min.js in kendoui-rails-0.1.0
- old
+ new
@@ -1,11 +1,11 @@
/*
-* Kendo UI Web v2012.3.1114 (http://kendoui.com)
-* Copyright 2012 Telerik AD. All rights reserved.
+* Kendo UI Web v2013.1.319 (http://kendoui.com)
+* Copyright 2013 Telerik AD. All rights reserved.
*
* Kendo UI Web commercial licenses may be obtained at
* https://www.kendoui.com/purchase/license-agreement/kendo-ui-web-commercial.aspx
* If you do not own a commercial license, this file shall be governed by the
* GNU General Public License (GPL) version 3.
* For GPL requirements, please review: http://www.gnu.org/copyleft/gpl.html
*/
-(function(e,n){function s(n){return e.trim(n).replace(/ /gi,"")}var t=window.kendo,l=t.ui,i=e.proxy,o=e.extend,r=e.grep,a=e.map,u=e.inArray,c="k-state-selected",d="asc",f="desc",p="change",m="kendoPopup",k="kendoFilterMenu",h="kendoMenu",w=".kendoColumnMenu",b=/(\[|\]|\$|\.|\:|\+)/g,C=l.Widget,_=C.extend({init:function(n,s){var l,o=this;C.fn.init.call(o,n,s),n=o.element,s=o.options,o.owner=s.owner,o.dataSource=s.dataSource,o.field=n.attr(t.attr("field")),l=n.find(".k-header-column-menu"),l[0]||(l=n.prepend('<a class="k-header-column-menu" href="#"><span class="k-icon k-i-arrowhead-s"/></a>').find(".k-header-column-menu")),o.link=l.attr("tabindex",-1).on("click"+w,i(o._click,o)),o.wrapper=e('<div class="k-column-menu"/>'),o.wrapper.html(t.template(v)({ns:t.ns,messages:s.messages,sortable:s.sortable,filterable:s.filterable,columns:o._ownerColumns(),showColumns:s.columns})),o.popup=o.wrapper[m]({anchor:l,open:i(o._open,o),activate:i(o._activate,o),close:o.options.closeCallback}).data(m),o._menu(),o._sort(),o._columns(),o._filter()},options:{name:"ColumnMenu",messages:{sortAscending:"Sort Ascending",sortDescending:"Sort Descending",filter:"Filter",columns:"Columns"},columns:!0,sortable:!0,filterable:!0},destroy:function(){var e=this;C.fn.destroy.call(e),e.filterMenu&&e.filterMenu.destroy(),e.dataSource.unbind("refresh",e._refreshHandler),e.options.columns&&(e.owner.unbind("columnShow",e._updateColumnsMenuHandler),e.owner.unbind("columnHide",e._updateColumnsMenuHandler)),e.menu.element.off(w),e.menu.destroy(),e.wrapper.off(w),e.popup.destroy(),e.link.off(w)},close:function(){this.menu.close(),this.popup.close(),this.popup.element.off("keydown"+w)},_click:function(e){e.preventDefault(),e.stopPropagation(),this.popup.toggle()},_open:function(){var n=this;e(".k-column-menu").not(n.wrapper).each(function(){e(this).data(m).close()}),n.popup.element.on("keydown"+w,function(e){e.keyCode==t.keys.ESC&&n.close()})},_activate:function(){this.menu.element.focus()},_ownerColumns:function(){var e=this.owner.columns,n=r(e,function(e){var n=!0,t=s(e.title||"");return(e.menu===!1||!e.field&&!t.length)&&(n=!1),n});return a(n,function(n){return{field:n.field||n.title,title:n.title||n.field,hidden:n.hidden,index:u(n,e)}})},_menu:function(){this.menu=this.wrapper.children()[h]({orientation:"vertical",closeOnClick:!1}).data(h)},_sort:function(){var n=this;n.options.sortable&&(n.refresh(),n._refreshHandler=i(n.refresh,n),n.dataSource.bind(p,n._refreshHandler),n.menu.element.on("click"+w,".k-sort-asc, .k-sort-desc",function(){var s=e(this),t=s.hasClass("k-sort-asc")?d:f;s.parent().find(".k-sort-"+(t==d?f:d)).removeClass(c),n._sortDataSource(s,t),n.close()}))},_sortDataSource:function(e,s){var t,l,i=this,o=i.options.sortable,r=i.dataSource,a=r.sort()||[];if(e.hasClass(c)&&o&&o.allowUnsort!==!1?(e.removeClass(c),s=n):e.addClass(c),o===!0||"single"===o.mode)a=[{field:i.field,dir:s}];else{for(t=0,l=a.length;l>t;t++)if(a[t].field===i.field){a.splice(t,1);break}a.push({field:i.field,dir:s})}r.sort(a)},_columns:function(){var n=this;n.options.columns&&(n._updateColumnsMenu(),n._updateColumnsMenuHandler=i(n._updateColumnsMenu,n),n.owner.bind(["columnHide","columnShow"],n._updateColumnsMenuHandler),n.menu.bind("select",function(s){var l,i,o,a,c=e(s.item),d=n.owner.columns;c.parent().closest("li.k-columns-item")[0]&&(l=c.find(":checkbox"),l.attr("disabled")||(a=l.attr(t.attr("field")),o=r(d,function(e){return e.field==a||e.title==a})[0],i=u(o,d),o.hidden===!0?n.owner.showColumn(i):n.owner.hideColumn(i)))}))},_updateColumnsMenu:function(){var e="["+t.attr("field")+"=",n=this._ownerColumns(),s=a(n,function(n){return e+n.field.replace(b,"\\$1")+"]"}).join(","),l=r(n,function(e){return!e.hidden}),i=a(l,function(n){return e+n.field.replace(b,"\\$1")+"]"}).join(",");this.wrapper.find(s).attr("checked",!1),this.wrapper.find(i).attr("checked",!0).attr("disabled",1==l.length)},_filter:function(){var e=this,n=e.options;n.filterable!==!1&&(e.filterMenu=e.wrapper.find(".k-filterable")[k](o(!0,{},{appendToElement:!0,dataSource:n.dataSource,values:n.values,field:e.field},n.filterable)).data(k))},refresh:function(){var e,n,s,t=this,l=t.options.dataSource.sort()||[],i=t.field;for(t.wrapper.find(".k-sort-asc, .k-sort-desc").removeClass(c),n=0,s=l.length;s>n;n++)e=l[n],i==e.field&&t.wrapper.find(".k-sort-"+e.dir).addClass(c)}}),v='<ul>#if(sortable){#<li class="k-item k-sort-asc"><span class="k-link"><span class="k-sprite k-i-sort-asc"></span>${messages.sortAscending}</span></li><li class="k-item k-sort-desc"><span class="k-link"><span class="k-sprite k-i-sort-desc"></span>${messages.sortDescending}</span></li>#if(showColumns || filterable){#<li class="k-separator"></li>#}##}##if(showColumns){#<li class="k-item k-columns-item"><span class="k-link"><span class="k-sprite k-i-columns"></span>${messages.columns}</span><ul>#for (var col in columns) {#<li><input type="checkbox" data-#=ns#field="#=columns[col].field#" data-#=ns#index="#=columns[col].index#"/>#=columns[col].title#</li>#}#</ul></li>#if(filterable){#<li class="k-separator"></li>#}##}##if(filterable){#<li class="k-item k-filter-item"><span class="k-link"><span class="k-sprite k-filter"></span>${messages.filter}</span><ul><li><div class="k-filterable"></div></li></ul></li>#}#</ul>';l.plugin(_)})(window.kendo.jQuery);
+("function"==typeof define&&define.amd?define:function(e,n){return n()})(["./kendo.popup.min","./kendo.filtermenu.min","./kendo.menu.min"],function(){(function(e,n){function s(n){return e.trim(n).replace(/ /gi,"")}var i=window.kendo,t=i.ui,o=e.proxy,l=e.extend,r=e.grep,a=e.map,u=e.inArray,c="k-state-selected",d="asc",p="desc",f="change",m="init",k="kendoPopup",h="kendoFilterMenu",w="kendoMenu",b=".kendoColumnMenu",_=/(\[|\]|\$|\.|\:|\+)/g,v=t.Widget,C=v.extend({init:function(n,s){var t,l=this;v.fn.init.call(l,n,s),n=l.element,s=l.options,l.owner=s.owner,l.dataSource=s.dataSource,l.field=n.attr(i.attr("field")),t=n.find(".k-header-column-menu"),t[0]||(t=n.prepend('<a class="k-header-column-menu" href="#"><span class="k-icon k-i-arrowhead-s"/></a>').find(".k-header-column-menu")),l.link=t.attr("tabindex",-1).on("click"+b,o(l._click,l)),l.wrapper=e('<div class="k-column-menu"/>')},_init:function(){var e=this,n=e.options;e.wrapper.html(i.template(g)({ns:i.ns,messages:n.messages,sortable:n.sortable,filterable:n.filterable,columns:e._ownerColumns(),showColumns:n.columns})),e.popup=e.wrapper[k]({anchor:e.link,open:o(e._open,e),activate:o(e._activate,e),close:e.options.closeCallback}).data(k),e._menu(),e._sort(),e._columns(),e._filter(),e.trigger(m,{field:e.field,container:e.wrapper})},events:[m],options:{name:"ColumnMenu",messages:{sortAscending:"Sort Ascending",sortDescending:"Sort Descending",filter:"Filter",columns:"Columns"},columns:!0,sortable:!0,filterable:!0},destroy:function(){var e=this;v.fn.destroy.call(e),e.filterMenu&&e.filterMenu.destroy(),e.dataSource.unbind("refresh",e._refreshHandler),e.options.columns&&(e.owner.unbind("columnShow",e._updateColumnsMenuHandler),e.owner.unbind("columnHide",e._updateColumnsMenuHandler)),e.menu&&(e.menu.element.off(b),e.menu.destroy()),e.wrapper.off(b),e.popup&&e.popup.destroy(),e.link.off(b)},close:function(){this.menu.close(),this.popup.close(),this.popup.element.off("keydown"+b)},_click:function(e){e.preventDefault(),e.stopPropagation(),this.popup||this._init(),this.popup.toggle()},_open:function(){var n=this;e(".k-column-menu").not(n.wrapper).each(function(){e(this).data(k).close()}),n.popup.element.on("keydown"+b,function(e){e.keyCode==i.keys.ESC&&n.close()})},_activate:function(){this.menu.element.focus()},_ownerColumns:function(){var e=this.owner.columns,n=r(e,function(e){var n=!0,i=s(e.title||"");return(e.menu===!1||!e.field&&!i.length)&&(n=!1),n});return a(n,function(n){return{field:n.field||n.title,title:n.title||n.field,hidden:n.hidden,index:u(n,e)}})},_menu:function(){this.menu=this.wrapper.children()[w]({orientation:"vertical",closeOnClick:!1}).data(w)},_sort:function(){var n=this;n.options.sortable&&(n.refresh(),n._refreshHandler=o(n.refresh,n),n.dataSource.bind(f,n._refreshHandler),n.menu.bind("select",function(s){var i,t=e(s.item);t.hasClass("k-sort-asc")?i=d:t.hasClass("k-sort-desc")&&(i=p),i&&(t.parent().find(".k-sort-"+(i==d?p:d)).removeClass(c),n._sortDataSource(t,i),n.close())}))},_sortDataSource:function(e,s){var i,t,o=this,l=o.options.sortable,r=o.dataSource,a=r.sort()||[];if(e.hasClass(c)&&l&&l.allowUnsort!==!1?(e.removeClass(c),s=n):e.addClass(c),l===!0||"single"===l.mode)a=[{field:o.field,dir:s}];else{for(i=0,t=a.length;t>i;i++)if(a[i].field===o.field){a.splice(i,1);break}a.push({field:o.field,dir:s})}r.sort(a)},_columns:function(){var n=this;n.options.columns&&(n._updateColumnsMenu(),n._updateColumnsMenuHandler=o(n._updateColumnsMenu,n),n.owner.bind(["columnHide","columnShow"],n._updateColumnsMenuHandler),n.menu.bind("select",function(s){var t,o,l,a,c=e(s.item),d=n.owner.columns;c.parent().closest("li.k-columns-item")[0]&&(t=c.find(":checkbox"),t.attr("disabled")||(a=t.attr(i.attr("field")),l=r(d,function(e){return e.field==a||e.title==a})[0],o=u(l,d),l.hidden===!0?n.owner.showColumn(o):n.owner.hideColumn(o)))}))},_updateColumnsMenu:function(){var e="["+i.attr("field")+"=",n=this._ownerColumns(),s=a(n,function(n){return e+'"'+n.field.replace(_,"\\$1")+'"]'}).join(","),t=r(n,function(e){return!e.hidden}),o=a(t,function(n){return e+'"'+n.field.replace(_,"\\$1")+'"]'}).join(",");this.wrapper.find(s).prop("checked",!1),this.wrapper.find(o).prop("checked",!0).prop("disabled",1==t.length)},_filter:function(){var e=this,n=e.options;n.filterable!==!1&&(e.filterMenu=e.wrapper.find(".k-filterable")[h](l(!0,{},{appendToElement:!0,dataSource:n.dataSource,values:n.values,field:e.field},n.filterable)).data(h))},refresh:function(){var e,n,s,i=this,t=i.options.dataSource.sort()||[],o=i.field;for(i.wrapper.find(".k-sort-asc, .k-sort-desc").removeClass(c),n=0,s=t.length;s>n;n++)e=t[n],o==e.field&&i.wrapper.find(".k-sort-"+e.dir).addClass(c)}}),g='<ul>#if(sortable){#<li class="k-item k-sort-asc"><span class="k-link"><span class="k-sprite k-i-sort-asc"></span>${messages.sortAscending}</span></li><li class="k-item k-sort-desc"><span class="k-link"><span class="k-sprite k-i-sort-desc"></span>${messages.sortDescending}</span></li>#if(showColumns || filterable){#<li class="k-separator"></li>#}##}##if(showColumns){#<li class="k-item k-columns-item"><span class="k-link"><span class="k-sprite k-i-columns"></span>${messages.columns}</span><ul>#for (var col in columns) {#<li><input type="checkbox" data-#=ns#field="#=columns[col].field#" data-#=ns#index="#=columns[col].index#"/>#=columns[col].title#</li>#}#</ul></li>#if(filterable){#<li class="k-separator"></li>#}##}##if(filterable){#<li class="k-item k-filter-item"><span class="k-link"><span class="k-sprite k-filter"></span>${messages.filter}</span><ul><li><div class="k-filterable"></div></li></ul></li>#}#</ul>';t.plugin(C)})(window.kendo.jQuery)});
\ No newline at end of file