/*! Copyright 2010-2021 SpryMedia Ltd. This source file is free software, available under the following license: MIT license - http://datatables.net/license/mit This source file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. For details please refer to: http://www.datatables.net FixedColumns 3.3.3 ©2010-2021 SpryMedia Ltd - datatables.net/license */ (function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(v){return d(v,window,document)}):"object"===typeof exports?module.exports=function(v,w){v||(v=window);w&&w.fn.dataTable||(w=require("datatables.net")(v,w).$);return d(w,v,v.document)}:d(jQuery,window,document)})(function(d,v,w,z){var y=d.fn.dataTable,B,q=function(a,b){var c=this;if(this instanceof q){if(b===z||!0===b)b={};var f=d.fn.dataTable.camelToHungarian;f&&(f(q.defaults,q.defaults,!0),f(q.defaults, b));a=(new d.fn.dataTable.Api(a)).settings()[0];this.s={dt:a,iTableColumns:a.aoColumns.length,aiOuterWidths:[],aiInnerWidths:[],rtl:"rtl"===d(a.nTable).css("direction")};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}}};if(a._oFixedColumns)throw"FixedColumns already initialised on this table"; a._oFixedColumns=this;a._bInitComplete?this._fnConstruct(b):a.oApi._fnCallbackReg(a,"aoInitComplete",function(){c._fnConstruct(b)},"FixedColumns")}else alert("FixedColumns warning: FixedColumns must be initialised with the 'new' keyword.")};d.extend(q.prototype,{fnUpdate:function(){this._fnDraw(!0)},fnRedrawLayout:function(){this._fnColCalc();this._fnGridLayout();this.fnUpdate()},fnRecalculateHeight:function(a){delete a._DTTC_iHeight;a.style.height="auto"},fnSetRowHeight:function(a,b){a.style.height= b+"px"},fnGetPosition:function(a){var b=this.s.dt.oInstance;if(d(a).parents(".DTFC_Cloned").length){if("tr"===a.nodeName.toLowerCase())return a=d(a).index(),b.fnGetPosition(d("tr",this.s.dt.nTBody)[a]);var c=d(a).index();a=d(a.parentNode).index();return[b.fnGetPosition(d("tr",this.s.dt.nTBody)[a]),c,b.oApi._fnVisibleToColumnIndex(this.s.dt,c)]}return b.fnGetPosition(a)},fnToFixedNode:function(a,b){var c;b=this.s.iRightColumns&&(c=d(this.dom.clone.right.body).find("[data-dt-row="+a+"][data-dt-column="+b+"]"));return c&&c.length?c[0]:(new d.fn.dataTable.Api(this.s.dt)).cell(a,b).node()},_fnConstruct:function(a){var b=this;if("function"!=typeof this.s.dt.oInstance.fnVersionCheck||!0!==this.s.dt.oInstance.fnVersionCheck("1.8.0"))alert("FixedColumns "+q.VERSION+" required DataTables 1.8.0 or later. Please upgrade your DataTables installation");else 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");else{this.s=d.extend(!0,this.s,q.defaults,a);a=this.s.dt.oClasses;this.dom.grid.dt=d(this.s.dt.nTable).parents("div."+a.sScrollWrapper)[0];this.dom.scroller=d("div."+a.sScrollBody,this.dom.grid.dt)[0];this._fnColCalc();this._fnGridSetup();var c,f=!1;d(this.s.dt.nTableWrapper).on("mousedown.DTFC",function(g){0===g.button&&(f=!0,d(w).one("mouseup", function(){f=!1}))});d(this.dom.scroller).on("mouseover.DTFC touchstart.DTFC",function(){f||(c="main")}).on("scroll.DTFC",function(g){!c&&g.originalEvent&&(c="main");if("main"===c||"key"===c)0')[0], c=b.childNodes[0],f=b.childNodes[1];this.dom.grid.dt.parentNode.insertBefore(b,this.dom.grid.dt);b.appendChild(this.dom.grid.dt);this.dom.grid.wrapper=b;0b.clientWidth&&(c.x=!0);a.offsetHeight>b.clientHeight&&(c.y=!0);return c},_fnDraw:function(a){this._fnGridLayout();this._fnCloneLeft(a);this._fnCloneRight(a);d(this.dom.scroller).trigger("scroll");null!==this.s.fnDrawCallback&&this.s.fnDrawCallback.call(this,this.dom.clone.left,this.dom.clone.right);d(this).trigger("draw.dtfc",{leftClone:this.dom.clone.left,rightClone:this.dom.clone.right})},_fnCloneRight:function(a){if(!(0>=this.s.iRightColumns)){var b,c=[];for(b=this.s.iTableColumns- this.s.iRightColumns;b=this.s.iLeftColumns)){var b,c=[];for(b=0;bthead",a.header);l.empty();var n=0;for(h=m.length;nthead",a.header)[0]);n=0;for(h=m.length;ntbody>tr",e.dom.body).css("height","auto");null!==a.body&&(d(a.body).remove(),a.body=null);a.body=d(this.dom.body).clone(!0)[0];a.body.className+=" DTFC_Cloned";a.body.style.paddingBottom=g.oScroll.iBarWidth+"px";a.body.style.marginBottom=2*g.oScroll.iBarWidth+"px";null!==a.body.getAttribute("id")&&a.body.removeAttribute("id");d(">thead>tr",a.body).empty();d(">tfoot",a.body).remove();var C=d("tbody",a.body)[0];d(C).empty();if(0thead>tr", a.body)[0];for(k=0;ktbody>tr",e.dom.body).each(function(u){u=!1===e.s.dt.oFeatures.bServerSide?e.s.dt.aiDisplay[e.s.dt._iDisplayStart+u]:u;var D=e.s.dt.aoData[u].anCells||d(this).children("td, th"),A=this.cloneNode(!1);A.removeAttribute("id");A.setAttribute("data-dt-row", u);for(k=0;ktbody>tr",e.dom.body).each(function(u){p=this.cloneNode(!0);p.className+=" DTFC_NoData";d("td",p).html("");C.appendChild(p)});a.body.style.width="100%";a.body.style.margin="0";a.body.style.padding="0";g.oScroller!==z&&(h=g.oScroller.dom.force,b.forcer?b.forcer.style.height=h.style.height:(b.forcer= h.cloneNode(!0),b.liner.appendChild(b.forcer)));b.liner.appendChild(a.body);this._fnEqualiseHeights("tbody",e.dom.body,a.body);if(null!==g.nTFoot){if(f){null!==a.footer&&a.footer.parentNode.removeChild(a.footer);a.footer=d(this.dom.footer).clone(!0,!0)[0];a.footer.className+=" DTFC_Cloned";a.footer.style.width="100%";b.foot.appendChild(a.footer);m=this._fnCopyLayout(g.aoFooter,c,!0);b=d(">tfoot",a.footer);b.empty();n=0;for(h=m.length;ntfoot",a.footer)[0]),n=0,h=m.length;nthead",a.header)[0]);d(b).each(function(u){x=c[u];this.style.width=e.s.aiInnerWidths[x]+"px"});null!==e.s.dt.nTFoot&&(b=g.oApi._fnGetUniqueThs(g,d(">tfoot",a.footer)[0]),d(b).each(function(u){x=c[u];this.style.width=e.s.aiInnerWidths[x]+ "px"}))},_fnGetTrNodes:function(a){for(var b=[],c=0,f=a.childNodes.length;c"+a+">tr:eq(0)",b).children(":first");a.outerHeight();a.height();f=this._fnGetTrNodes(f);b=this._fnGetTrNodes(c);var e=[];c=0;for(a=b.length;ch?k:h;"semiauto"==this.s.sHeightMatch&&(f[c]._DTTC_iHeight=h);e.push(h)}c=0;for(a=b.length;c").css({position:"absolute",top:0,left:0,height:10,width:50,overflow:"scroll"}).appendTo("body");B=a[0].clientWidth===a[0].offsetWidth&&0!==this._fnDTOverflow().bar;a.remove()}return B}});q.defaults={iLeftColumns:1,iRightColumns:0,fnDrawCallback:null,sHeightMatch:"semiauto"}; q.version="3.3.3";y.Api.register("fixedColumns()",function(){return this});y.Api.register("fixedColumns().update()",function(){return this.iterator("table",function(a){a._oFixedColumns&&a._oFixedColumns.fnUpdate()})});y.Api.register("fixedColumns().relayout()",function(){return this.iterator("table",function(a){a._oFixedColumns&&a._oFixedColumns.fnRedrawLayout()})});y.Api.register("rows().recalcHeight()",function(){return this.iterator("row",function(a,b){a._oFixedColumns&&a._oFixedColumns.fnRecalculateHeight(this.row(b).node())})}); y.Api.register("fixedColumns().rowIndex()",function(a){a=d(a);return a.parents(".DTFC_Cloned").length?this.rows({page:"current"}).indexes()[a.index()]:this.row(a).index()});y.Api.register("fixedColumns().cellIndex()",function(a){a=d(a);if(a.parents(".DTFC_Cloned").length){var b=a.parent().index();b=this.rows({page:"current"}).indexes()[b];a=a.parents(".DTFC_LeftWrapper").length?a.index():this.columns().flatten().length-this.context[0]._oFixedColumns.s.iRightColumns+a.index();return{row:b,column:this.column.index("toData", a),columnVisible:a}}return this.cell(a).index()});y.Api.registerPlural("cells().fixedNodes()","cell().fixedNode()",function(){return this.iterator("cell",function(a,b,c){return a._oFixedColumns?a._oFixedColumns.fnToFixedNode(b,c):this.cell(b,c).node()},1)});d(w).on("init.dt.fixedColumns",function(a,b){if("dt"===a.namespace){a=b.oInit.fixedColumns;var c=y.defaults.fixedColumns;if(a||c)c=d.extend({},a,c),!1!==a&&new q(b,c)}});d.fn.dataTable.FixedColumns=q;return d.fn.DataTable.FixedColumns=q});