public/static/common/js/plugin/datatables/FixedColumns.min.js

(开头部分) 12KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

var FixedColumns;(function(c,b,a){FixedColumns=function(e,d){var f=this;if(!this instanceof FixedColumns){alert("FixedColumns warning: FixedColumns must be initialised with the 'new' keyword.");return}if(typeof d=="undefined"){d={}}this.s={dt:e.fnSettings(),iTableColumns:e.fnSettings().aoColumns.length,aiOuterWidths:[],aiInnerWidths:[]};this.dom={scroller:null,header:null,body:null,footer:null,grid:{wrapper:null,dt:null,left:{wrapper:null,head:null,body:null,foot:null},right:{wrapper:null,head:null,body:null,foot:null}},clone:{left:{header:null,body:null,footer:null},right:{header:null,body:null,footer:null}}};this.s.dt.oFixedColumns=this;if(!this.s.dt._bInitComplete){this.s.dt.oApi._fnCallbackReg(this.s.dt,"aoInitComplete",function(){f._fnConstruct(d)},"FixedColumns")}else{this._fnConstruct(d)}};FixedColumns.prototype={fnUpdate:function(){this._fnDraw(true)},fnRedrawLayout:function(){this._fnColCalc();this._fnGridLayout();this.fnUpdate()},fnRecalculateHeight:function(d){delete d._DTTC_iHeight;d.style.height="auto"},fnSetRowHeight:function(e,d){e.style.height=d+"px"},_fnConstruct:function(e){var f,d,j,h=this;if(typeof this.s.dt.oInstance.fnVersionCheck!="function"||this.s.dt.oInstance.fnVersionCheck("1.8.0")!==true){alert("FixedColumns "+FixedColumns.VERSION+" required DataTables 1.8.0 or later. Please upgrade your DataTables installation");return}if(this.s.dt.oScroll.sX===""){this.s.dt.oInstance.oApi._fnLog(this.s.dt,1,"FixedColumns is not needed (no x-scrolling in DataTables enabled), so no action will be taken. Use 'FixedHeader' for column fixing when scrolling is not enabled");return}this.s=c.extend(true,this.s,FixedColumns.defaults,e);this.dom.grid.dt=c(this.s.dt.nTable).parents("div.dataTables_scroll")[0];this.dom.scroller=c("div.dataTables_scrollBody",this.dom.grid.dt)[0];this._fnColCalc();this._fnGridSetup();c(this.dom.scroller).scroll(function(){if(h.s.iLeftColumns>0){h.dom.grid.left.liner.scrollTop=h.dom.scroller.scrollTop}if(h.s.iRightColumns>0){h.dom.grid.right.liner.scrollTop=h.dom.scroller.scrollTop}});if(h.s.iLeftColumns>0){c(h.dom.grid.left.liner).scroll(function(){h.dom.scroller.scrollTop=h.dom.grid.left.liner.scrollTop;if(h.s.iRightColumns>0){h.dom.grid.right.liner.scrollTop=h.dom.grid.left.liner.scrollTop}});c(h.dom.grid.left.liner).bind("mousewheel",function(k){var i=k.originalEvent.wheelDeltaX/3;h.dom.scroller.scrollLeft-=i})}if(h.s.iRightColumns>0){c(h.dom.grid.right.liner).scroll(function(){h.dom.scroller.scrollTop=h.dom.grid.right.liner.scrollTop;if(h.s.iLeftColumns>0){h.dom.grid.left.liner.scrollTop=h.dom.grid.right.liner.scrollTop}});c(h.dom.grid.right.liner).bind("mousewheel",function(k){var i=k.originalEvent.wheelDeltaX/3;h.dom.scroller.scrollLeft-=i})}c(b).resize(function(){h._fnGridLayout.call(h)});var g=true;this.s.dt.aoDrawCallback=[{fn:function(){h._fnDraw.call(h,g);h._fnGridLayout(h);g=false},sName:"FixedColumns"}].concat(this.s.dt.aoDrawCallback);this._fnGridLayout();this.s.dt.oInstance.fnDraw(false)},_fnColCalc:function(){var g=this;var d=c(this.dom.grid.dt).width();var f=0;var e=0;this.s.aiInnerWidths=[];c("tbody>tr:eq(0)>td, tbody>tr:eq(0)>th",this.s.dt.nTable).each(function(h){g.s.aiInnerWidths.push(c(this).width());var j=c(this).outerWidth();g.s.aiOuterWidths.push(j);if(h<g.s.iLeftColumns){f+=j}if(g.s.iTableColumns-g.s.iRightColumns<=h){e+=j}});this.s.iLeftWidth=this.s.sLeftWidth=="fixed"?f:(f/d)*100;this.s.iRightWidth=this.s.sRightWidth=="fixed"?e:(e/d)*100},_fnGridSetup:function(){var h=this;var d=this._fnDTOverflow();var i;this.dom.body=this.s.dt.nTable;this.dom.header=this.s.dt.nTHead.parentNode;this.dom.header.parentNode.parentNode.style.position="relative";var f=c('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;"><div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;"><div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div><div class="DTFC_LeftBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><div class="DTFC_LeftBodyLiner" style="position:relative; top:0; left:0; overflow-y:scroll;"></div></div><div class="DTFC_LeftFootWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div></div><div class="DTFC_RightWrapper" style="position:absolute; top:0; left:0;"><div class="DTFC_RightHeadWrapper" style="position:relative; top:0; left:0;"><div class="DTFC_RightHeadBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div></div><div class="DTFC_RightBodyWrapper" style="position:relative; top:0; left:0; overflow:hidden;"><div class="DTFC_RightBodyLiner" style="position:relative; top:0; left:0; overflow-y:scroll;"></div></div><div class="DTFC_RightFootWrapper" style="position:relative; top:0; left:0;"><div class="DTFC_RightFootBlocker DTFC_Blocker" style="position:absolute; top:0; bottom:0;"></div></div></div></div>')[0];var g=f.childNodes[0];var e=f.childNodes[1];this.dom.grid.dt.parentNode.insertBefore(f,this.dom.grid.dt);f.appendChild(this.dom.grid.dt);this.dom.grid.wrapper=f;if(this.s.iLeftColumns>0){this.dom.grid.left.wrapper=g;this.dom.grid.left.head=g.childNodes[0];this.dom.grid.left.body=g.childNodes[1];this.dom.grid.left.liner=c("div.DTFC_LeftBodyLiner",f)[0];f.appendChild(g)}if(this.s.iRightColumns>0){this.dom.grid.right.wrapper=e;this.dom.grid.right.head=e.childNodes[0];this.dom.grid.right.body=e.childNodes[1];this.dom.grid.right.liner=c("div.DTFC_RightBodyLiner",f)[0];i=c("div.DTFC_RightHeadBlocker",f)[0];i.style.width=d.bar+"px";i.style.right=-d.bar+"px";this.dom.grid.right.headBlock=i;i=c("div.DTFC_RightFootBlocker",f)[0];i.style.width=d.bar+"px";i.style.right=-d.bar+"px";this.dom.grid.right.footBlock=i;f.appendChild(e)}if(this.s.dt.nTFoot){this.dom.footer=this.s.dt.nTFoot.parentNode;if(this.s.iLeftColumns>0){this.dom.grid.left.foot=g.childNodes[2]}if(this.s.iRightColumns>0){this.dom.grid.right.foot=e.childNodes[2]}}},_fnGridLayout:function(){var k=this.dom.grid;var j=c(k.wrapper).width();var f=c(this.s.dt.nTable.parentNode).height();var i=c(this.s.dt.nTable.parentNode.parentNode).height();var h,g,e;var d=this._fnDTOverflow();if(this.s.sLeftWidth=="fixed"){h=this.s.iLeftWidth}else{h=(this.s.iLeftWidth/100)*j}if(this.s.sRightWidth=="fixed"){e=this.s.iRightWidth}else{e=(this.s.iRightWidth/100)*j}if(d.x){f-=d.bar}k.wrapper.style.height=i+"px";if(this.s.iLeftColumns>0){k.left.wrapper.style.width=h+"px";k.left.wrapper.style.height=i+"px";k.left.body.style.height=f+"px";if(k.left.foot){k.left.foot.style.top=(d.x?d.bar:0)+"px"}k.left.liner.style.width=(h+d.bar)+"px";k.left.liner.style.height=f+"px"}if(this.s.iRightColumns>0){g=j-e;if(d.y){g-=d.bar}k.right.wrapper.style.width=e+"px";k.right.wrapper.style.left=g+"px";k.right.wrapper.style.height=i+"px";k.right.body.style.height=f+"px";if(k.right.foot){k.right.foot.style.top=(d.x?d.bar:0)+"px"}k.right.liner.style.width=(e+d.bar)+"px";k.right.liner.style.height=f+"px";k.right.headBlock.style.display=d.x?"block":"none";k.right.footBlock.style.display=d.x?"block":"none"}},_fnDTOverflow:function(){var f=this.s.dt.nTable;var d=f.parentNode;var e={x:false,y:false,bar:this.s.dt.oScroll.iBarWidth};if(f.offsetWidth>d.offsetWidth){e.x=true}if(f.offsetHeight>d.offsetHeight){e.y=true}return e},_fnDraw:function(d){this._fnCloneLeft(d);this._fnCloneRight(d);if(this.s.fnDrawCallback!==null){this.s.fnDrawCallback.call(this,this.dom.clone.left,this.dom.clone.right)}c(this).trigger("draw",{leftClone:this.dom.clone.left,rightClone:this.dom.clone.right})},_fnCloneRight:function(e){if(this.s.iRightColumns<=0){return}var g=this,d,h,f=[];for(d=this.s.iTableColumns-this.s.iRightColumns;d<this.s.iTableColumns;d++){f.push(d)}this._fnClone(this.dom.clone.right,this.dom.grid.right,f,e)},_fnCloneLeft:function(e){if(this.s.iLeftColumns<=0){return}var g=this,d,h,f=[];for(d=0;d<this.s.iLeftColumns;d++){f.push(d)}this._fnClone(this.dom.clone.left,this.dom.grid.left,f,e)},_fnCopyLayout:function(o,q){var n=[];var l=[];var f=[];for(var h=0,e=o.length;h<e;h++){var m=[];m.nTr=c(o[h].nTr).clone(true)[0];for(var g=0,p=this.s.iTableColumns;g<p;g++){if(c.inArray(g,q)===-1){continue}var k=c.inArray(o[h][g].cell,f);if(k===-1){var d=c(o[h][g].cell).clone(true)[0];l.push(d);f.push(o[h][g].cell);m.push({cell:d,unique:o[h][g].unique})}else{m.push({cell:l[k],unique:o[h][g].unique})}}n.push(m)}return n},_fnClone:function(u,t,f,d){var l=this,w,s,v,A,r,h,x,p,m,g,n,B;if(d){if(u.header!==null){u.header.parentNode.removeChild(u.header)}u.header=c(this.dom.header).clone(true)[0];u.header.className+=" DTFC_Cloned";u.header.style.width="100%";t.head.appendChild(u.header);g=this._fnCopyLayout(this.s.dt.aoHeader,f);n=c(">thead",u.header);n.empty();for(w=0,s=g.length;w<s;w++){n[0].appendChild(g[w].nTr)}this.s.dt.oApi._fnDrawHead(this.s.dt,g,true)}else{g=this._fnCopyLayout(this.s.dt.aoHeader,f);B=[];this.s.dt.oApi._fnDetectHeader(B,c(">thead",u.header)[0]);for(w=0,s=g.length;w<s;w++){for(v=0,A=g[w].length;v<A;v++){B[w][v].cell.className=g[w][v].cell.className;c("span.DataTables_sort_icon",B[w][v].cell).each(function(){this.className=c("span.DataTables_sort_icon",g[w][v].cell)[0].className})}}}this._fnEqualiseHeights("thead",this.dom.header,u.header);if(this.s.sHeightMatch=="auto"){c(">tbody>tr",l.dom.body).css("height","auto")}if(u.body!==null){u.body.parentNode.removeChild(u.body);u.body=null}u.body=c(this.dom.body).clone(true)[0];u.body.className+=" DTFC_Cloned";u.body.style.paddingBottom=this.s.dt.oScroll.iBarWidth+"px";u.body.style.marginBottom=(this.s.dt.oScroll.iBarWidth*2)+"px";if(u.body.getAttribute("id")!==null){u.body.removeAttribute("id")}c(">thead>tr",u.body).empty();c(">tfoot",u.body).remove();var o=c("tbody",u.body)[0];c(o).empty();if(this.s.dt.aiDisplay.length>0){var k=c(">thead>tr",u.body)[0];for(m=0;m<f.length;m++){x=f[m];p=c(this.s.dt.aoColumns[x].nTh).clone(true)[0];p.innerHTML="";var q=p.style;q.paddingTop="0";q.paddingBottom="0";q.borderTopWidth="0";q.borderBottomWidth="0";q.height=0;q.width=l.s.aiInnerWidths[x]+"px";k.appendChild(p)}c(">tbody>tr",l.dom.body).each(function(D){var E=this.cloneNode(false);var j=l.s.dt.oFeatures.bServerSide===false?l.s.dt.aiDisplay[l.s.dt._iDisplayStart+D]:D;for(m=0;m<f.length;m++){var C=l.s.dt.oApi._fnGetTdNodes(l.s.dt,j);x=f[m];if(C.length>0){p=c(C[x]).clone(true)[0];E.appendChild(p)}}o.appendChild(E)})}else{c(">tbody>tr",l.dom.body).each(function(i){p=this.cloneNode(true);p.className+=" DTFC_NoData";c("td",p).html("");o.appendChild(p)})}u.body.style.width="100%";u.body.style.margin="0";u.body.style.padding="0";if(d){if(typeof this.s.dt.oScroller!="undefined"){t.liner.appendChild(this.s.dt.oScroller.dom.force.cloneNode(true))}}t.liner.appendChild(u.body);this._fnEqualiseHeights("tbody",l.dom.body,u.body);if(this.s.dt.nTFoot!==null){if(d){if(u.footer!==null){u.footer.parentNode.removeChild(u.footer)}u.footer=c(this.dom.footer).clone(true)[0];u.footer.className+=" DTFC_Cloned";u.footer.style.width="100%";t.foot.appendChild(u.footer);g=this._fnCopyLayout(this.s.dt.aoFooter,f);var e=c(">tfoot",u.footer);e.empty();for(w=0,s=g.length;w<s;w++){e[0].appendChild(g[w].nTr)}this.s.dt.oApi._fnDrawHead(this.s.dt,g,true)}else{g=this._fnCopyLayout(this.s.dt.aoFooter,f);var y=[];this.s.dt.oApi._fnDetectHeader(y,c(">tfoot",u.footer)[0]);for(w=0,s=g.length;w<s;w++){for(v=0,A=g[w].length;v<A;v++){y[w][v].cell.className=g[w][v].cell.className}}}this._fnEqualiseHeights("tfoot",this.dom.footer,u.footer)}var z=this.s.dt.oApi._fnGetUniqueThs(this.s.dt,c(">thead",u.header)[0]);c(z).each(function(j){x=f[j];this.style.width=l.s.aiInnerWidths[x]+"px"});if(l.s.dt.nTFoot!==null){z=this.s.dt.oApi._fnGetUniqueThs(this.s.dt,c(">tfoot",u.footer)[0]);c(z).each(function(j){x=f[j];this.style.width=l.s.aiInnerWidths[x]+"px"})}},_fnGetTrNodes:function(e){var g=[];for(var f=0,d=e.childNodes.length;f<d;f++){if(e.childNodes[f].nodeName.toUpperCase()=="TR"){g.push(e.childNodes[f])}}return g},_fnEqualiseHeights:function(p,e,o){if(this.s.sHeightMatch=="none"&&p!=="thead"&&p!=="tfoot"){return}var m=this,j,f,d,h,t,s,l=e.getElementsByTagName(p)[0],n=o.getElementsByTagName(p)[0],g=c(">"+p+">tr:eq(0)",e).children(":first"),r=g.outerHeight()-g.height(),k=this._fnGetTrNodes(l),q=this._fnGetTrNodes(n);for(j=0,f=q.length;j<f;j++){t=k[j].offsetHeight;s=q[j].offsetHeight;d=s>t?s:t;if(this.s.sHeightMatch=="semiauto"){k[j]._DTTC_iHeight=d}q[j].style.height=d+"px";k[j].style.height=d+"px"}}};FixedColumns.defaults={iLeftColumns:1,iRightColumns:0,fnDrawCallback:null,sLeftWidth:"fixed",iLeftWidth:null,sRightWidth:"fixed",iRightWidth:null,sHeightMatch:"semiauto"};FixedColumns.prototype.CLASS="FixedColumns";FixedColumns.VERSION="2.5.0.dev"})(jQuery,window,document);

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。