yn_hxy_web/hxy-web/plugs/datatables/dataTables.colVis.min.js

4 lines
10 KiB
JavaScript
Raw Normal View History

2024-07-26 18:15:22 +08:00
/*! ColVis 1.1.2
* ©2010-2015 SpryMedia Ltd - datatables.net/license
*/
!function(a,b,c){var d=function(a,d){"use strict";var e=function(b,c){this.CLASS&&"ColVis"==this.CLASS||alert("Warning: ColVis must be initialised with the keyword 'new'"),"undefined"==typeof c&&(c={});var d=a.fn.dataTable.camelToHungarian;return d&&(d(e.defaults,e.defaults,!0),d(e.defaults,c)),this.s={"dt":null,"oInit":c,"hidden":!0,"abOriginal":[]},this.dom={"wrapper":null,"button":null,"collection":null,"background":null,"catcher":null,"buttons":[],"groupButtons":[],"restore":null},e.aInstances.push(this),this.s.dt=a.fn.dataTable.Api?new a.fn.dataTable.Api(b).settings()[0]:b,this._fnConstruct(c),this};return e.prototype={"button":function(){return this.dom.wrapper},"fnRebuild":function(){this.rebuild()},"rebuild":function(){for(var a=this.dom.buttons.length-1;a>=0;a--)this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length),this.dom.groupButtons.splice(0,this.dom.groupButtons.length),this.dom.restore&&this.dom.restore.parentNode(this.dom.restore),this._fnAddGroups(),this._fnAddButtons(),this._fnDrawCallback()},"_fnConstruct":function(c){this._fnApplyCustomisation(c);var d,e,f=this;for(this.dom.wrapper=b.createElement("div"),this.dom.wrapper.className="ColVis",this.dom.button=a("<button />",{"class":this.s.dt.bJUI?"ColVis_Button ColVis_MasterButton ui-button ui-state-default":"ColVis_Button ColVis_MasterButton"}).append("<span>"+this.s.buttonText+"</span>").bind("mouseover"==this.s.activate?"mouseover":"click",function(a){a.preventDefault(),f._fnCollectionShow()}).appendTo(this.dom.wrapper)[0],this.dom.catcher=this._fnDomCatcher(),this.dom.collection=this._fnDomCollection(),this.dom.background=this._fnDomBackground(),this._fnAddGroups(),this._fnAddButtons(),d=0,e=this.s.dt.aoColumns.length;e>d;d++)this.s.abOriginal.push(this.s.dt.aoColumns[d].bVisible);this.s.dt.aoDrawCallback.push({"fn":function(){f._fnDrawCallback.call(f)},"sName":"ColVis"}),a(this.s.dt.oInstance).bind("column-reorder.dt",function(a,b,c){for(d=0,e=f.s.aiExclude.length;e>d;d++)f.s.aiExclude[d]=c.aiInvertMapping[f.s.aiExclude[d]];var g=f.s.abOriginal.splice(c.iFrom,1)[0];f.s.abOriginal.splice(c.iTo,0,g),f.fnRebuild()}),a(this.s.dt.oInstance).bind("destroy.dt",function(){a(f.dom.wrapper).remove()}),this._fnDrawCallback()},"_fnApplyCustomisation":function(b){a.extend(!0,this.s,e.defaults,b),!this.s.showAll&&this.s.bShowAll&&(this.s.showAll=this.s.sShowAll),!this.s.restore&&this.s.bRestore&&(this.s.restore=this.s.sRestore);var c=this.s.groups,d=this.s.aoGroups;if(c)for(var f=0,g=c.length;g>f;f++)c[f].title&&(d[f].sTitle=c[f].title),c[f].columns&&(d[f].aiColumns=c[f].columns)},"_fnDrawCallback":function(){for(var b,d=this.s.dt.aoColumns,e=this.dom.buttons,f=this.s.aoGroups,g=0,h=e.length;h>g;g++)b=e[g],b.__columnIdx!==c&&a("input",b).prop("checked",d[b.__columnIdx].bVisible);for(var i=function(a){for(var b=0,c=a.length;c>b;b++)if(d[a[b]].bVisible===!1)return!1;return!0},j=function(a){for(var b=0,c=a.length;c>b;b++)if(d[a[b]].bVisible===!0)return!1;return!0},k=0,l=f.length;l>k;k++)i(f[k].aiColumns)?(a("input",this.dom.groupButtons[k]).prop("checked",!0),a("input",this.dom.groupButtons[k]).prop("indeterminate",!1)):j(f[k].aiColumns)?(a("input",this.dom.groupButtons[k]).prop("checked",!1),a("input",this.dom.groupButtons[k]).prop("indeterminate",!1)):a("input",this.dom.groupButtons[k]).prop("indeterminate",!0)},"_fnAddGroups":function(){var a;if("undefined"!=typeof this.s.aoGroups)for(var b=0,c=this.s.aoGroups.length;c>b;b++)a=this._fnDomGroupButton(b),this.dom.groupButtons.push(a),this.dom.buttons.push(a),this.dom.collection.appendChild(a)},"_fnAddButtons":function(){var b,c=this.s.dt.aoColumns;if(-1===a.inArray("all",this.s.aiExclude))for(var d=0,e=c.length;e>d;d++)-1===a.inArray(d,this.s.aiExclude)&&(b=this._fnDomColumnButton(d),b.__columnIdx=d,this.dom.buttons.push(b));"alpha"===this.s.order&&this.dom.buttons.sort(function(a,b){var d=c[a.__columnIdx].sTitle,e=c[b.__columnIdx].sTitle;return d===e?0:e>d?-1:1}),this.s.restore&&(b=this._fnDomRestoreButton(),b.className+=" ColVis_Restore",this.dom.buttons.push(b))