All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.datatables.net-select.js.dataTables.select.min.js Maven / Gradle / Ivy

There is a newer version: 0.66.0.1
Show newest version
/*! Select for DataTables 1.2.7
 * 2015-2018 SpryMedia Ltd - datatables.net/license/mit
 */
(function(a){if(typeof define==="function"&&define.amd){define(["jquery","datatables.net"],function(b){return a(b,window,document)})}else{if(typeof exports==="object"){module.exports=function(b,c){if(!b){b=window}if(!c||!c.fn.dataTable){c=require("datatables.net")(b,c).$}return a(c,b,b.document)}}else{a(jQuery,window,document)}}}(function(e,h,m,g){var l=e.fn.dataTable;l.select={};l.select.version="1.2.7";l.select.init=function(w){var F=w.settings()[0];var D=F.oInit.select;var z=l.defaults.select;var u=D===g?z:D;var C="row";var v="api";var E=false;var x=true;var y="td, th";var B="selected";var A=false;F._select={};if(u===true){v="os";A=true}else{if(typeof u==="string"){v=u;A=true}else{if(e.isPlainObject(u)){if(u.blurable!==g){E=u.blurable}if(u.info!==g){x=u.info}if(u.items!==g){C=u.items}if(u.style!==g){v=u.style;A=true}if(u.selector!==g){y=u.selector}if(u.className!==g){B=u.className}}}}w.select.selector(y);w.select.items(C);w.select.style(v);w.select.blurable(E);w.select.info(x);F._select.className=B;e.fn.dataTable.ext.order["select-checkbox"]=function(H,G){return this.api().column(G,{order:"index"}).nodes().map(function(I){if(H._select.items==="row"){return e(I).parent().hasClass(H._select.className)}else{if(H._select.items==="cell"){return e(I).hasClass(H._select.className)}}return false})};if(!A&&e(w.table().node()).hasClass("selectable")){w.select.style("os")}};function n(A,u,z){var x;var v;var B;var w=function(F,D){if(F>D){var E=D;D=F;F=E}var C=false;return A.columns(":visible").indexes().filter(function(G){if(G===F){C=true}if(G===D){C=false;return true}return C})};var y=function(G,D){var E=A.rows({search:"applied"}).indexes();if(E.indexOf(G)>E.indexOf(D)){var F=D;D=G;G=F}var C=false;return E.filter(function(H){if(H===G){C=true}if(H===D){C=false;return true}return C})};if(!A.cells({selected:true}).any()&&!z){v=w(0,u.column);B=y(0,u.row)}else{v=w(z.column,u.column);B=y(z.row,u.row)}x=A.cells(B,v).flatten();if(!A.cells(u,{selected:true}).any()){A.cells(x).select()}else{A.cells(x).deselect()}}function j(w){var v=w.settings()[0];var u=v._select.selector;e(w.table().container()).off("mousedown.dtSelect",u).off("mouseup.dtSelect",u).off("click.dtSelect",u);e("body").off("click.dtSelect"+w.table().node().id)}function q(y){var x=e(y.table().container());var w=y.settings()[0];var u=w._select.selector;var v;x.on("mousedown.dtSelect",u,function(z){if(z.shiftKey||z.metaKey||z.ctrlKey){x.css("-moz-user-select","none").one("selectstart.dtSelect",u,function(){return false})}if(h.getSelection){v=h.getSelection()}}).on("mouseup.dtSelect",u,function(){x.css("-moz-user-select","")}).on("click.dtSelect",u,function(B){var C=y.select.items();var F;if(h.getSelection){var E=h.getSelection();if(!E.anchorNode||e(E.anchorNode).closest("table")[0]===y.table().node()){if(E!==v){return}}}var H=y.settings()[0];var A=y.settings()[0].oClasses.sWrapper.replace(/ /g,".");if(e(B.target).closest("div."+A)[0]!=y.table().container()){return}var G=y.cell(e(B.target).closest("td, th"));if(!G.any()){return}var z=e.Event("user-select.dt");f(y,z,[C,G,B]);if(z.isDefaultPrevented()){return}var D=G.index();if(C==="row"){F=D.row;c(B,y,H,"row",F)}else{if(C==="column"){F=G.index().column;c(B,y,H,"column",F)}else{if(C==="cell"){F=G.index();c(B,y,H,"cell",F)}}}H._select_lastCell=D});e("body").on("click.dtSelect"+y.table().node().id,function(z){if(w._select.blurable){if(e(z.target).parents().filter(y.table().container()).length){return}if(e(z.target).parents("html").length===0){return}if(e(z.target).parents("div.DTE").length){return}o(w,true)}})}function f(w,v,u,x){if(x&&!w.flatten().length){return}if(typeof v==="string"){v=v+".dt"}u.unshift(w);e(w.table().node()).trigger(v,u)}function s(x){var u=x.settings()[0];if(!u._select.info||!u.aanFeatures.i){return}if(x.select.style()==="api"){return}var y=x.rows({selected:true}).flatten().length;var w=x.columns({selected:true}).flatten().length;var v=x.cells({selected:true}).flatten().length;var z=function(C,B,A){C.append(e('').append(x.i18n("select."+B+"s",{_:"%d "+B+"s selected",0:"",1:"1 "+B+" selected"},A)))};e.each(u.aanFeatures.i,function(C,D){D=e(D);var A=e('');z(A,"row",y);z(A,"column",w);z(A,"cell",v);var B=D.children("span.select-info");if(B.length){B.remove()}if(A.text()!==""){D.append(A)}})}function p(u){var v=new l.Api(u);u.aoRowCreatedCallback.push({fn:function(B,z,x){var y,w;var A=u.aoData[x];if(A._select_selected){e(B).addClass(u._select.className)}for(y=0,w=u.aoColumns.length;yv){var y=v;v=w;w=y}x.splice(v+1,x.length);x.splice(0,w)}if(!B[z](u,{selected:true}).any()){B[z+"s"](x).select()}else{x.splice(e.inArray(u,x),1);B[z+"s"](x).deselect()}}function o(u,w){if(w||u._select.style==="single"){var v=new l.Api(u);v.rows({selected:true}).deselect();v.columns({selected:true}).deselect();v.cells({selected:true}).deselect()}}function c(B,A,v,z,u){var y=A.select.style();var w=A[z](u,{selected:true}).any();if(y==="os"){if(B.ctrlKey||B.metaKey){A[z](u).select(!w)}else{if(B.shiftKey){if(z==="cell"){n(A,u,v._select_lastCell||null)}else{b(A,z,u,v._select_lastCell?v._select_lastCell[z]:null)}}else{var x=A[z+"s"]({selected:true});if(w&&x.flatten().length===1){A[z](u).deselect()}else{x.deselect();A[z](u).select()}}}}else{if(y=="multi+shift"){if(B.shiftKey){if(z==="cell"){n(A,u,v._select_lastCell||null)}else{b(A,z,u,v._select_lastCell?v._select_lastCell[z]:null)}}else{A[z](u).select(!w)}}else{A[z](u).select(!w)}}}e.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(u,v){l.ext.selector[v.type].push(function(B,C,y){var A=C.selected;var D;var x=[];if(A!==true&&A!==false){return y}for(var z=0,w=y.length;z0)});this.disable()},destroy:function(w,v,u){w.off(u._eventNamespace)}}});e.each(["Row","Column","Cell"],function(u,w){var v=w.toLowerCase();l.ext.buttons["select"+w+"s"]={text:k("select"+w+"s","Select "+v+"s"),className:"buttons-select-"+v+"s",action:function(){this.select.items(v)},init:function(y){var x=this;y.on("selectItems.dt.DT",function(B,z,A){x.active(A===v)})}}});e(m).on("preInit.dt.dtSelect",function(v,u){if(v.namespace!=="dt"){return}l.select.init(new l.Api(u))});return l.select}));




© 2015 - 2025 Weber Informatics LLC | Privacy Policy