/*! FixedColumns 5.0.0 * © SpryMedia Ltd - datatables.net/license */ import jQuery from"jquery";import DataTable from"datatables.net";let $=jQuery;!function(){"use strict";var u,l;o.prototype.end=function(t){return void 0!==t?(0<=t&&t<=this.s.dt.columns().count()&&(this.c.end=t,this._addStyles()),this):this.c.end},o.prototype.left=function(t){return this.s.rtl?this.end(t):this.start(t)},o.prototype.right=function(t){return this.s.rtl?this.start(t):this.end(t)},o.prototype.start=function(t){return void 0!==t?(0<=t&&t<=this.s.dt.columns().count()&&(this.c.start=t,this._addStyles()),this):this.c.start},o.prototype._addStyles=function(){var s=this.s.dt,i=this,l=this.s.dt.columns(":visible").count(),o=s.table().header.structure(":visible"),n=s.table().footer.structure(":visible"),d=s.columns(":visible").widths().toArray(),t=u(s.table().node()).closest("div.dt-scroll"),e=u(s.table().node()).closest("div.dt-scroll-body")[0],r=this.s.rtl,a=this.c.start,c=this.c.end,f=r?c:a,r=r?a:c,h=s.settings()[0].oBrowser.barWidth;if(0===t.length)return this;e.offsetWidth===e.clientWidth&&(h=0),s.columns(":visible").every(function(t){var e,t=s.column.index("toVisible",t);tl.clientWidth+Math.abs(e)+1,t.toggleClass(this.classes.tableScrollingStart,i),t.toggleClass(this.classes.tableScrollingEnd,l),t.toggleClass(this.classes.tableScrollingLeft,i&&s||l&&!s),t.toggleClass(this.classes.tableScrollingRight,l&&s||i&&!s))},o.prototype._setKeyTableListener=function(){var a=this;this.s.dt.on("key-focus.dt.dtfc",function(t,e,s){var i,l,o,n=u(s.node()).offset(),d=a.dom.scroller[0],r=u(u(a.s.dt.table().node()).closest("div.dt-scroll-body"));0o.left&&(i=r.scrollLeft(),r.scrollLeft(i-(o.left-(n.left+l)))))})},o.prototype._sum=function(t,e,s){return(t=(s=void 0===s?!1:s)?t.slice().reverse():t).slice(0,e).reduce(function(t,e){return t+e},0)},o.version="5.0.0",o.classes={bottomBlocker:"dtfc-bottom-blocker",fixedEnd:"dtfc-fixed-end",fixedLeft:"dtfc-fixed-left",fixedRight:"dtfc-fixed-right",fixedStart:"dtfc-fixed-start",tableFixedEnd:"dtfc-has-end",tableFixedLeft:"dtfc-has-left",tableFixedRight:"dtfc-has-right",tableFixedStart:"dtfc-has-start",tableScrollingEnd:"dtfc-scrolling-end",tableScrollingLeft:"dtfc-scrolling-left",tableScrollingRight:"dtfc-scrolling-right",tableScrollingStart:"dtfc-scrolling-start",topBlocker:"dtfc-top-blocker"},o.defaults={i18n:{button:"FixedColumns"},start:1,end:0}; /*! FixedColumns 5.0.0 * © SpryMedia Ltd - datatables.net/license */var s=o;function o(t,e){var s,i=this;if(l&&l.versionCheck&&l.versionCheck("2"))return t=new l.Api(t),this.classes=u.extend(!0,{},o.classes),this.c=u.extend(!0,{},o.defaults,e),this.s={dt:t,rtl:"rtl"===u(t.table().node()).css("direction")},e&&void 0!==e.leftColumns&&(e.left=e.leftColumns),e&&void 0!==e.left&&(this.c[this.s.rtl?"end":"start"]=e.left),e&&void 0!==e.rightColumns&&(e.right=e.rightColumns),e&&void 0!==e.right&&(this.c[this.s.rtl?"start":"end"]=e.right),this.dom={bottomBlocker:u("
").addClass(this.classes.bottomBlocker),topBlocker:u("
").addClass(this.classes.topBlocker),scroller:u("div.dt-scroll-body",this.s.dt.table().container())},this.s.dt.settings()[0]._bInitComplete?(this._addStyles(),this._setKeyTableListener()):t.one("init.dt.dtfc",function(){i._addStyles(),i._setKeyTableListener()}),t.on("column-sizing.dt.dtfc column-reorder.dt.dtfc draw.dt.dtfc",function(){return i._addStyles()}),s=l.util.debounce(function(){i._addStyles()},50),t.on("column-visibility.dt.dtfc",function(){s()}),this.dom.scroller.on("scroll.dtfc",function(){return i._scroll()}),this._scroll(),t.settings()[0]._fixedColumns=this,t.on("destroy",function(){return i._destroy()}),this;throw new Error("FixedColumns requires DataTables 2 or newer")}t=$,l=(u=t).fn.dataTable,$.fn.dataTable.FixedColumns=s,$.fn.DataTable.FixedColumns=s;var t=DataTable.Api.register;function i(t,e){void 0===e&&(e=null);t=new DataTable.Api(t),e=e||t.init().fixedColumns||DataTable.defaults.fixedColumns;new s(t,e)}t("fixedColumns()",function(){return this}),t("fixedColumns().start()",function(t){var e=this.context[0];return void 0!==t?(e._fixedColumns.start(t),this):e._fixedColumns.start()}),t("fixedColumns().end()",function(t){var e=this.context[0];return void 0!==t?(e._fixedColumns.end(t),this):e._fixedColumns.end()}),t("fixedColumns().left()",function(t){var e=this.context[0];return void 0!==t?(e._fixedColumns.left(t),this):e._fixedColumns.left()}),t("fixedColumns().right()",function(t){var e=this.context[0];return void 0!==t?(e._fixedColumns.right(t),this):e._fixedColumns.right()}),DataTable.ext.buttons.fixedColumns={action:function(t,e,s,i){$(s).attr("active")?($(s).removeAttr("active").removeClass("active"),e.fixedColumns().start(0),e.fixedColumns().end(0)):($(s).attr("active","true").addClass("active"),e.fixedColumns().start(i.config.start),e.fixedColumns().end(i.config.end))},config:{start:1,end:0},init:function(t,e,s){void 0===t.settings()[0]._fixedColumns&&i(t.settings(),s),$(e).attr("active","true").addClass("active"),t.button(e).text(s.text||t.i18n("buttons.fixedColumns",t.settings()[0]._fixedColumns.c.i18n.button))},text:null},$(document).on("plugin-init.dt",function(t,e){"dt"!==t.namespace||!e.oInit.fixedColumns&&!DataTable.defaults.fixedColumns||e._fixedColumns||i(e,null)})}();export default DataTable;