META-INF.resources.bower_components.datatables.net-buttons.js.dataTables.buttons.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-data-tables Show documentation
Show all versions of jwebmp-data-tables Show documentation
The JWebSwing implementation for Data Tables
The newest version!
/*! Buttons for DataTables 1.5.2
* ©2016-2018 SpryMedia Ltd - datatables.net/license
*/
(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(f,i,k,c){var e=f.fn.dataTable;var g=0;var j=0;var l=e.ext.buttons;var b=function(r,q){if(typeof(q)==="undefined"){q={}}if(q===true){q={}}if(f.isArray(q)){q={buttons:q}}this.c=f.extend(true,{},b.defaults,q);if(q.buttons){this.c.buttons=q.buttons}this.s={dt:new e.Api(r),buttons:[],listenKeys:"",namespace:"dtb"+(g++)};this.dom={container:f("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)};this._constructor()};f.extend(b.prototype,{action:function(r,s){var q=this._nodeToButton(r);if(s===c){return q.conf.action}q.conf.action=s;return this},active:function(u,r){var s=this._nodeToButton(u);var q=this.c.dom.button.active;var t=f(s.node);if(r===c){return t.hasClass(q)}t.toggleClass(q,r===c?true:r);return this},add:function(s,q){var v=this.s.buttons;if(typeof q==="string"){var u=q.split("-");var w=this.s;for(var t=0,r=u.length-1;t=0;r--){this.remove(s.buttons[r].node)}}if(s.conf.destroy){s.conf.destroy.call(t.button(v),t,f(v),s.conf)}this._removeKey(s.conf);f(s.node).remove();var q=f.inArray(s,u);u.splice(q,1);return this},text:function(v,r){var s=this._nodeToButton(v);var w=this.c.dom.collection.buttonLiner;var q=s.inCollection&&w&&w.tag?w.tag:this.c.dom.buttonLiner.tag;var u=this.s.dt;var t=f(s.node);var x=function(y){return typeof y==="function"?y(u,t,s.conf):y};if(r===c){return x(s.conf.text)}s.conf.text=r;if(q){t.children(q).html(x(r))}else{t.html(x(r))}return this},_constructor:function(){var u=this;var t=this.s.dt;var v=t.settings()[0];var s=this.c.buttons;if(!v._buttons){v._buttons=[]}v._buttons.push({inst:this,name:this.c.name});for(var r=0,q=s.length;r").addClass(t.className).attr("role","menu");q.conf._collection=q.collection;this._expandButton(q.buttons,q.conf.buttons,true,s)}if(z.init){z.init.call(r.button(q.node),r,f(q.node),z)}u++}},_buildButton:function(u,y){var r=this.c.dom.button;var t=this.c.dom.buttonLiner;var v=this.c.dom.collection;var s=this.s.dt;var A=function(D){return typeof D==="function"?D(s,x,u):D};if(y&&v.button){r=v.button}if(y&&v.buttonLiner){t=v.buttonLiner}if(u.available&&!u.available(s,u)){return false}var w=function(G,F,E,D){D.action.call(F.button(E),G,F,E,D);f(F.table().node()).triggerHandler("buttons-action.dt",[F.button(E),F,E,D])};var C=u.tag||r.tag;var x=f("<"+C+"/>").addClass(r.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(D){D.preventDefault();if(!x.hasClass(r.disabled)&&u.action){w(D,s,x,u)}x.blur()}).on("keyup.dtb",function(D){if(D.keyCode===13){if(!x.hasClass(r.disabled)&&u.action){w(D,s,x,u)}}});if(C.toLowerCase()==="a"){x.attr("href","#")}if(C.toLowerCase()==="button"){x.attr("type","button")}if(t.tag){var q=f("<"+t.tag+"/>").html(A(u.text)).addClass(t.className);if(t.tag.toLowerCase()==="a"){q.attr("href","#")}x.append(q)}else{x.html(A(u.text))}if(u.enabled===false){x.addClass(r.disabled)}if(u.className){x.addClass(u.className)}if(u.titleAttr){x.attr("title",A(u.titleAttr))}if(u.attr){x.attr(u.attr)}if(!u.namespace){u.namespace=".dt-button-"+(j++)}var B=this.c.dom.buttonContainer;var z;if(B&&B.tag){z=f("<"+B.tag+"/>").addClass(B.className).append(x)}else{z=x}this._addKey(u);return{conf:u,node:x.get(0),inserter:z,buttons:[],inCollection:y,collection:null}},_nodeToButton:function(u,t){if(!t){t=this.s.buttons}for(var s=0,q=t.length;s30){throw"Buttons: Too many iterations"}}return f.isArray(A)?A:f.extend({},A)};w=u(w);while(w&&w.extend){if(!l[w.extend]){throw"Cannot extend unknown button type: "+w.extend}var s=u(l[w.extend]);if(f.isArray(s)){return s}else{if(!s){return false}}var x=s.className;w=f.extend({},s,w);if(x&&w.className!==x){w.className=x+" "+w.className}var t=w.postfixButtons;if(t){if(!w.buttons){w.buttons=[]}for(v=0,y=t.length;v ").addClass(r).css("display","none").appendTo("body").fadeIn(s)}else{f("body > div."+r).fadeOut(s,function(){f(this).removeClass(r).remove()})}};b.instanceSelector=function(u,r){if(!u){return f.map(r,function(w){return w.inst})}var q=[];var t=f.map(r,function(w){return w.name});var s=function(x){if(f.isArray(x)){for(var y=0,w=x.length;yu||J.dropup){J._collection.css("top",B.top-J._collection.outerHeight()-5)}var H=B.left+J._collection.outerWidth();var r=y.offset().left+y.width();if(H>r){J._collection.css("left",B.left-(H-r))}var w=E.offset().left+J._collection.outerWidth();if(w>f(i).width()){J._collection.css("left",B.left-(w-f(i).width()))}}else{var D=J._collection.height()/2;if(D>f(i).height()/2){D=f(i).height()/2}J._collection.css("marginTop",D*-1)}}if(J.background){b.background(true,J.backgroundClassName,J.fade)}var C=function(){J._collection.fadeOut(J.fade,function(){J._collection.detach()});f("div.dt-button-background").off("click.dtb-collection");b.background(false,J.backgroundClassName,J.fade);f("body").off(".dtb-collection");F.off("buttons-action.b-internal")};setTimeout(function(){f("div.dt-button-background").on("click.dtb-collection",function(){});f("body").on("click.dtb-collection",function(N){var M=f.fn.addBack?"addBack":"andSelf";if(!f(N.target).parents()[M]().filter(J._collection).length){C()}}).on("keyup.dtb-collection",function(M){if(M.keyCode===27){C()}});if(J.autoClose){F.on("buttons-action.b-internal",function(){C()})}},10)},background:true,collectionLayout:"",backgroundClassName:"dt-button-background",autoClose:false,fade:400,attr:{"aria-haspopup":true}},copy:function(r,q){if(l.copyHtml5){return"copyHtml5"}if(l.copyFlash&&l.copyFlash.available(r,q)){return"copyFlash"}},csv:function(r,q){if(l.csvHtml5&&l.csvHtml5.available(r,q)){return"csvHtml5"}if(l.csvFlash&&l.csvFlash.available(r,q)){return"csvFlash"}},excel:function(r,q){if(l.excelHtml5&&l.excelHtml5.available(r,q)){return"excelHtml5"}if(l.excelFlash&&l.excelFlash.available(r,q)){return"excelFlash"}},pdf:function(r,q){if(l.pdfHtml5&&l.pdfHtml5.available(r,q)){return"pdfHtml5"}if(l.pdfFlash&&l.pdfFlash.available(r,q)){return"pdfFlash"}},pageLength:function(r){var q=r.settings()[0].aLengthMenu;var s=f.isArray(q[0])?q[0]:q;var u=f.isArray(q[0])?q[1]:q;var t=function(v){return v.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},v.page.len())};return{extend:"collection",text:t,className:"buttons-page-length",autoClose:true,buttons:f.map(s,function(w,v){return{text:u[v],className:"button-page-length",action:function(y,x){x.page.len(w).draw()},init:function(B,A,x){var z=this;var y=function(){z.active(B.page.len()===w)};B.on("length.dt"+x.namespace,y);y()},destroy:function(z,y,x){z.off("length.dt"+x.namespace)}}}),init:function(y,x,v){var w=this;y.on("length.dt"+v.namespace,function(){w.text(t(y))})},destroy:function(x,w,v){x.off("length.dt"+v.namespace)}}}});e.Api.register("buttons()",function(s,q){if(q===c){q=s;s=c}this.selector.buttonGroup=s;var r=this.iterator(true,"table",function(t){if(t._buttons){return b.buttonSelector(b.instanceSelector(s,t._buttons),q)}},true);r._groupSelector=s;return r});e.Api.register("button()",function(s,q){var r=this.buttons(s,q);if(r.length>1){r.splice(1,r.length)}return r});e.Api.registerPlural("buttons().active()","button().active()",function(q){if(q===c){return this.map(function(r){return r.inst.active(r.node)})}return this.each(function(r){r.inst.active(r.node,q)})});e.Api.registerPlural("buttons().action()","button().action()",function(q){if(q===c){return this.map(function(r){return r.inst.action(r.node)})}return this.each(function(r){r.inst.action(r.node,q)})});e.Api.register(["buttons().enable()","button().enable()"],function(q){return this.each(function(r){r.inst.enable(r.node,q)})});e.Api.register(["buttons().disable()","button().disable()"],function(){return this.each(function(q){q.inst.disable(q.node)})});e.Api.registerPlural("buttons().nodes()","button().node()",function(){var q=f();f(this.each(function(r){q=q.add(r.inst.node(r.node))}));return q});e.Api.registerPlural("buttons().processing()","button().processing()",function(q){if(q===c){return this.map(function(r){return r.inst.processing(r.node)})}return this.each(function(r){r.inst.processing(r.node,q)})});e.Api.registerPlural("buttons().text()","button().text()",function(q){if(q===c){return this.map(function(r){return r.inst.text(r.node)})}return this.each(function(r){r.inst.text(r.node,q)})});e.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(q){q.inst.node(q.node).trigger("click")})});e.Api.registerPlural("buttons().containers()","buttons().container()",function(){var r=f();var q=this._groupSelector;this.iterator(true,"table",function(u){if(u._buttons){var s=b.instanceSelector(q,u._buttons);for(var v=0,t=s.length;v"+t+"":"";f('').html(t).append(f("")[typeof r==="string"?"html":"append"](r)).css("display","none").appendTo("body").fadeIn();if(s!==c&&s!==0){o=setTimeout(function(){q.buttons.info(false)},s)}return this});e.Api.register("buttons.exportData()",function(q){if(this.context.length){return d(new e.Api(this.context[0]),q)}});e.Api.register("buttons.exportInfo()",function(q){if(!q){q={}}return{filename:a(q),title:p(q),messageTop:n(this,q.message||q.messageTop,"top"),messageBottom:n(this,q.messageBottom,"bottom")}});var a=function(r){var q=r.filename==="*"&&r.title!=="*"&&r.title!==c&&r.title!==null&&r.title!==""?r.title:r.filename;if(typeof q==="function"){q=q()}if(q===c||q===null){return null}if(q.indexOf("*")!==-1){q=f.trim(q.replace("*",f("head > title").text()))}q=q.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,"");var s=m(r.extension);if(!s){s=""}return q+s};var m=function(q){if(q===null||q===c){return null}else{if(typeof q==="function"){return q()}}return q};var p=function(q){var r=m(q.title);return r===null?null:r.indexOf("*")!==-1?r.replace("*",f("head > title").text()||"Exported data"):r};var n=function(v,t,q){var u=m(t);if(u===null){return null}var r=f("caption",v.table().container()).eq(0);if(u==="*"){var s=r.css("caption-side");if(s!==q){return null}return r.length?r.text():""}return u};var h=f("")[0];var d=function(z,y){var I=f.extend(true,{},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:true,stripNewlines:true,decodeEntities:true,trim:true,format:{header:function(K){return B(K)},footer:function(K){return B(K)},body:function(K){return B(K)}},customizeData:null},y);var B=function(K){if(typeof K!=="string"){return K}K=K.replace(/