From 35b34f2c1252994c34f56ba01d4fdef1559fd830 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Mon, 7 Nov 2022 14:51:26 +0000 Subject: [PATCH] a36bf07f51b99b7207acb88ed9ccfe4a25067f56 Release 3.3.0 Sync to source repo @a36bf07f51b99b7207acb88ed9ccfe4a25067f56 --- datatables.json | 2 +- js/dataTables.fixedHeader.js | 6 +++--- js/dataTables.fixedHeader.min.js | 4 ++-- js/dataTables.fixedHeader.min.mjs | 4 ++-- js/dataTables.fixedHeader.mjs | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/datatables.json b/datatables.json index 8b9afd7..8fa6a39 100644 --- a/datatables.json +++ b/datatables.json @@ -11,5 +11,5 @@ ], "src-repo": "http://github.com/DataTables/FixedHeader", "last-tag": "3.2.4", - "last-sync": "859c87197a3661ae36209bb1cadf6513a9d0d0df" + "last-sync": "a36bf07f51b99b7207acb88ed9ccfe4a25067f56" } \ No newline at end of file diff --git a/js/dataTables.fixedHeader.js b/js/dataTables.fixedHeader.js index 7d457b0..72c2156 100644 --- a/js/dataTables.fixedHeader.js +++ b/js/dataTables.fixedHeader.js @@ -1,5 +1,5 @@ -/*! FixedHeader 3.2.4 +/*! FixedHeader 3.3.0 * ©2009-2022 SpryMedia Ltd - datatables.net/license */ @@ -47,7 +47,7 @@ var DataTable = $.fn.dataTable; * @summary FixedHeader * @description Fix a table's header or footer, so it is always visible while * scrolling - * @version 3.2.4 + * @version 3.3.0 * @author SpryMedia Ltd (www.sprymedia.co.uk) * @contact www.sprymedia.co.uk * @copyright SpryMedia Ltd. @@ -983,7 +983,7 @@ $.extend( FixedHeader.prototype, { * @type {String} * @static */ -FixedHeader.version = "3.2.4"; +FixedHeader.version = "3.3.0"; /** * Defaults diff --git a/js/dataTables.fixedHeader.min.js b/js/dataTables.fixedHeader.min.js index 251b63b..d97ab60 100644 --- a/js/dataTables.fixedHeader.min.js +++ b/js/dataTables.fixedHeader.min.js @@ -1,4 +1,4 @@ -/*! FixedHeader 3.2.4 +/*! FixedHeader 3.3.0 * ©2009-2022 SpryMedia Ltd - datatables.net/license */ -!function(o){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return o(t,window,document)}):"object"==typeof exports?module.exports=function(t,e){return t=t||window,(e=e||("undefined"!=typeof window?require("jquery"):require("jquery")(t))).fn.dataTable||require("datatables.net")(t,e),o(e,t,t.document)}:o(jQuery,window,document)}(function(m,H,x,v){"use strict";function s(t,e){if(!(this instanceof s))throw"FixedHeader must be initialised with the 'new' keyword.";if(!0===e&&(e={}),t=new r.Api(t),this.c=m.extend(!0,{},s.defaults,e),this.s={dt:t,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:m(H).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:t.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+o++,scrollLeft:{header:-1,footer:-1},enable:!0},this.dom={floatingHeader:null,thead:m(t.table().header()),tbody:m(t.table().body()),tfoot:m(t.table().footer()),header:{host:null,floating:null,floatingParent:m('
'),placeholder:null},footer:{host:null,floating:null,floatingParent:m('
'),placeholder:null}},this.dom.header.host=this.dom.thead.parent(),this.dom.footer.host=this.dom.tfoot.parent(),(e=t.settings()[0])._fixedHeader)throw"FixedHeader already initialised on table "+e.nTable.id;(e._fixedHeader=this)._constructor()}var r=m.fn.dataTable,o=0;return m.extend(s.prototype,{destroy:function(){var t=this.dom;this.s.dt.off(".dtfc"),m(H).off(this.s.namespace),t.header.rightBlocker&&t.header.rightBlocker.remove(),t.header.leftBlocker&&t.header.leftBlocker.remove(),t.footer.rightBlocker&&t.footer.rightBlocker.remove(),t.footer.leftBlocker&&t.footer.leftBlocker.remove(),this.c.header&&this._modeChange("in-place","header",!0),this.c.footer&&t.tfoot.length&&this._modeChange("in-place","footer",!0)},enable:function(t,e){this.s.enable=t,!e&&e!==v||(this._positions(),this._scroll(!0))},enabled:function(){return this.s.enable},headerOffset:function(t){return t!==v&&(this.c.headerOffset=t,this.update()),this.c.headerOffset},footerOffset:function(t){return t!==v&&(this.c.footerOffset=t,this.update()),this.c.footerOffset},update:function(t){var e;this.s.enable&&(e=this.s.dt.table().node(),m(e).is(":visible")?this.enable(!0,!1):this.enable(!1,!1),0!==m(e).children("thead").length&&(this._positions(),this._scroll(t===v||t)))},_constructor:function(){var o=this,i=this.s.dt,t=(m(H).on("scroll"+this.s.namespace,function(){o._scroll()}).on("resize"+this.s.namespace,r.util.throttle(function(){o.s.position.windowHeight=m(H).height(),o.update()},50)),m(".fh-fixedHeader")),t=(!this.c.headerOffset&&t.length&&(this.c.headerOffset=t.outerHeight()),m(".fh-fixedFooter"));!this.c.footerOffset&&t.length&&(this.c.footerOffset=t.outerHeight()),i.on("column-reorder.dt.dtfc column-visibility.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(t,e){o.update()}).on("draw.dt.dtfc",function(t,e){o.update(e!==i.settings()[0])}),i.on("destroy.dtfc",function(){o.destroy()}),this._positions(),this._scroll()},_clone:function(t,e){var o,i,s,r,n=this,d=this.s.dt,a=this.dom[t],f="header"===t?this.dom.thead:this.dom.tfoot;"footer"===t&&this._scrollEnabled()||(!e&&a.floating?a.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(e=m(x).scrollLeft(),o=m(x).scrollTop(),a.floating&&(null!==a.placeholder&&a.placeholder.remove(),this._unsize(t),a.floating.children().detach(),a.floating.remove()),i=m(d.table().node()),s=m(i.parent()),r=this._scrollEnabled(),a.floating=m(d.table().node().cloneNode(!1)).attr("aria-hidden","true").css({"table-layout":"fixed",top:0,left:0}).removeAttr("id").append(f),a.floatingParent.css({width:s.width(),overflow:"hidden",height:"fit-content",position:"fixed",left:r?i.offset().left+s.scrollLeft():0}).css("header"===t?{top:this.c.headerOffset,bottom:""}:{top:"",bottom:this.c.footerOffset}).addClass("footer"===t?"dtfh-floatingparentfoot":"dtfh-floatingparenthead").append(a.floating).appendTo("body"),this._stickyPosition(a.floating,"-"),(d=function(){var t=s.scrollLeft();n.s.scrollLeft={footer:t,header:t},a.floatingParent.scrollLeft(n.s.scrollLeft.header)})(),s.off("scroll.dtfh").on("scroll.dtfh",d),a.placeholder=f.clone(!1),a.placeholder.find("*[id]").removeAttr("id"),a.host.prepend(a.placeholder),this._matchWidths(a.placeholder,a.floating),m(x).scrollTop(o).scrollLeft(e)))},_stickyPosition:function(t,i){var s,r;this._scrollEnabled()&&(r="rtl"===m((s=this).s.dt.table().node()).css("direction"),t.find("th").each(function(){var t,e,o;"sticky"===m(this).css("position")&&(t=m(this).css("right"),e=m(this).css("left"),"auto"===t||r?"auto"!==e&&r&&(o=+e.replace(/px/g,"")+("-"===i?-1:1)*s.s.dt.settings()[0].oBrowser.barWidth,m(this).css("left",0b&&s+this.c.headerOffset+p.theadHeightc||this.dom.header.floatingParent===v?t=!0:this.dom.header.floatingParent.css({top:this.c.headerOffset,position:"fixed"}).append(this.dom.header.floating)):f="below",!t&&f===this.s.headerMode||this._modeChange(f,"header",t),this._horizontal("header",i)),u={offset:{top:0,left:0},height:0},g={offset:{top:0,left:0},height:0},this.c.footer&&this.dom.tfoot.length&&(!this.s.enable||!p.visible||p.tfootBottom+this.c.footerOffset<=a?r="in-place":c+p.tfootHeight+this.c.footerOffset>a&&b+this.c.footerOffsets&&(p=a+((c=s-o.top)>-u.height?c:0)-(u.offset.top+(c<-u.height?u.height:0)+g.height),h.outerHeight(p=p<0?0:p),Math.round(h.outerHeight())>=Math.round(p)?m(this.dom.tfoot.parent()).addClass("fixedHeader-floating"):m(this.dom.tfoot.parent()).removeClass("fixedHeader-floating"))),this.dom.header.floating&&this.dom.header.floatingParent.css("left",n-i),this.dom.footer.floating&&this.dom.footer.floatingParent.css("left",n-i),this.s.dt.settings()[0]._fixedColumns!==v&&(this.dom.header.rightBlocker=(b=function(t,e,o){var i;return null!==(o=o===v?0===(i=m("div.dtfc-"+t+"-"+e+"-blocker")).length?null:i.clone().css("z-index",1):o)&&("in"===f||"below"===f?o.appendTo("body").css({top:("top"===e?u:g).offset.top,left:"right"===t?n+d-o.width():n}):o.detach()),o})("right","top",this.dom.header.rightBlocker),this.dom.header.leftBlocker=b("left","top",this.dom.header.leftBlocker),this.dom.footer.rightBlocker=b("right","bottom",this.dom.footer.rightBlocker),this.dom.footer.leftBlocker=b("left","bottom",this.dom.footer.leftBlocker)))},_scrollEnabled:function(){var t=this.s.dt.settings()[0].oScroll;return""!==t.sY||""!==t.sX}}),s.version="3.2.4",s.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0},m.fn.dataTable.FixedHeader=s,m.fn.DataTable.FixedHeader=s,m(x).on("init.dt.dtfh",function(t,e,o){var i;"dt"===t.namespace&&(t=e.oInit.fixedHeader,i=r.defaults.fixedHeader,!t&&!i||e._fixedHeader||(i=m.extend({},i,t),!1!==t&&new s(e,i)))}),r.Api.register("fixedHeader()",function(){}),r.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.update()})}),r.Api.register("fixedHeader.enable()",function(e){return this.iterator("table",function(t){t=t._fixedHeader;e=e===v||e,t&&e!==t.enabled()&&t.enable(e)})}),r.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var t=this.context[0]._fixedHeader;if(t)return t.enabled()}return!1}),r.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.enabled()&&t.enable(!1)})}),m.each(["header","footer"],function(t,o){r.Api.register("fixedHeader."+o+"Offset()",function(e){var t=this.context;return e===v?t.length&&t[0]._fixedHeader?t[0]._fixedHeader[o+"Offset"]():v:this.iterator("table",function(t){t=t._fixedHeader;t&&t[o+"Offset"](e)})})}),r}); \ No newline at end of file +!function(o){"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return o(t,window,document)}):"object"==typeof exports?module.exports=function(t,e){return t=t||window,(e=e||("undefined"!=typeof window?require("jquery"):require("jquery")(t))).fn.dataTable||require("datatables.net")(t,e),o(e,t,t.document)}:o(jQuery,window,document)}(function(m,H,x,v){"use strict";function s(t,e){if(!(this instanceof s))throw"FixedHeader must be initialised with the 'new' keyword.";if(!0===e&&(e={}),t=new r.Api(t),this.c=m.extend(!0,{},s.defaults,e),this.s={dt:t,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:m(H).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:t.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+o++,scrollLeft:{header:-1,footer:-1},enable:!0},this.dom={floatingHeader:null,thead:m(t.table().header()),tbody:m(t.table().body()),tfoot:m(t.table().footer()),header:{host:null,floating:null,floatingParent:m('
'),placeholder:null},footer:{host:null,floating:null,floatingParent:m('
'),placeholder:null}},this.dom.header.host=this.dom.thead.parent(),this.dom.footer.host=this.dom.tfoot.parent(),(e=t.settings()[0])._fixedHeader)throw"FixedHeader already initialised on table "+e.nTable.id;(e._fixedHeader=this)._constructor()}var r=m.fn.dataTable,o=0;return m.extend(s.prototype,{destroy:function(){var t=this.dom;this.s.dt.off(".dtfc"),m(H).off(this.s.namespace),t.header.rightBlocker&&t.header.rightBlocker.remove(),t.header.leftBlocker&&t.header.leftBlocker.remove(),t.footer.rightBlocker&&t.footer.rightBlocker.remove(),t.footer.leftBlocker&&t.footer.leftBlocker.remove(),this.c.header&&this._modeChange("in-place","header",!0),this.c.footer&&t.tfoot.length&&this._modeChange("in-place","footer",!0)},enable:function(t,e){this.s.enable=t,!e&&e!==v||(this._positions(),this._scroll(!0))},enabled:function(){return this.s.enable},headerOffset:function(t){return t!==v&&(this.c.headerOffset=t,this.update()),this.c.headerOffset},footerOffset:function(t){return t!==v&&(this.c.footerOffset=t,this.update()),this.c.footerOffset},update:function(t){var e;this.s.enable&&(e=this.s.dt.table().node(),m(e).is(":visible")?this.enable(!0,!1):this.enable(!1,!1),0!==m(e).children("thead").length&&(this._positions(),this._scroll(t===v||t)))},_constructor:function(){var o=this,i=this.s.dt,t=(m(H).on("scroll"+this.s.namespace,function(){o._scroll()}).on("resize"+this.s.namespace,r.util.throttle(function(){o.s.position.windowHeight=m(H).height(),o.update()},50)),m(".fh-fixedHeader")),t=(!this.c.headerOffset&&t.length&&(this.c.headerOffset=t.outerHeight()),m(".fh-fixedFooter"));!this.c.footerOffset&&t.length&&(this.c.footerOffset=t.outerHeight()),i.on("column-reorder.dt.dtfc column-visibility.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(t,e){o.update()}).on("draw.dt.dtfc",function(t,e){o.update(e!==i.settings()[0])}),i.on("destroy.dtfc",function(){o.destroy()}),this._positions(),this._scroll()},_clone:function(t,e){var o,i,s,r,n=this,d=this.s.dt,a=this.dom[t],f="header"===t?this.dom.thead:this.dom.tfoot;"footer"===t&&this._scrollEnabled()||(!e&&a.floating?a.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(e=m(x).scrollLeft(),o=m(x).scrollTop(),a.floating&&(null!==a.placeholder&&a.placeholder.remove(),this._unsize(t),a.floating.children().detach(),a.floating.remove()),i=m(d.table().node()),s=m(i.parent()),r=this._scrollEnabled(),a.floating=m(d.table().node().cloneNode(!1)).attr("aria-hidden","true").css({"table-layout":"fixed",top:0,left:0}).removeAttr("id").append(f),a.floatingParent.css({width:s.width(),overflow:"hidden",height:"fit-content",position:"fixed",left:r?i.offset().left+s.scrollLeft():0}).css("header"===t?{top:this.c.headerOffset,bottom:""}:{top:"",bottom:this.c.footerOffset}).addClass("footer"===t?"dtfh-floatingparentfoot":"dtfh-floatingparenthead").append(a.floating).appendTo("body"),this._stickyPosition(a.floating,"-"),(d=function(){var t=s.scrollLeft();n.s.scrollLeft={footer:t,header:t},a.floatingParent.scrollLeft(n.s.scrollLeft.header)})(),s.off("scroll.dtfh").on("scroll.dtfh",d),a.placeholder=f.clone(!1),a.placeholder.find("*[id]").removeAttr("id"),a.host.prepend(a.placeholder),this._matchWidths(a.placeholder,a.floating),m(x).scrollTop(o).scrollLeft(e)))},_stickyPosition:function(t,i){var s,r;this._scrollEnabled()&&(r="rtl"===m((s=this).s.dt.table().node()).css("direction"),t.find("th").each(function(){var t,e,o;"sticky"===m(this).css("position")&&(t=m(this).css("right"),e=m(this).css("left"),"auto"===t||r?"auto"!==e&&r&&(o=+e.replace(/px/g,"")+("-"===i?-1:1)*s.s.dt.settings()[0].oBrowser.barWidth,m(this).css("left",0b&&s+this.c.headerOffset+p.theadHeightc||this.dom.header.floatingParent===v?t=!0:this.dom.header.floatingParent.css({top:this.c.headerOffset,position:"fixed"}).append(this.dom.header.floating)):f="below",!t&&f===this.s.headerMode||this._modeChange(f,"header",t),this._horizontal("header",i)),u={offset:{top:0,left:0},height:0},g={offset:{top:0,left:0},height:0},this.c.footer&&this.dom.tfoot.length&&(!this.s.enable||!p.visible||p.tfootBottom+this.c.footerOffset<=a?r="in-place":c+p.tfootHeight+this.c.footerOffset>a&&b+this.c.footerOffsets&&(p=a+((c=s-o.top)>-u.height?c:0)-(u.offset.top+(c<-u.height?u.height:0)+g.height),h.outerHeight(p=p<0?0:p),Math.round(h.outerHeight())>=Math.round(p)?m(this.dom.tfoot.parent()).addClass("fixedHeader-floating"):m(this.dom.tfoot.parent()).removeClass("fixedHeader-floating"))),this.dom.header.floating&&this.dom.header.floatingParent.css("left",n-i),this.dom.footer.floating&&this.dom.footer.floatingParent.css("left",n-i),this.s.dt.settings()[0]._fixedColumns!==v&&(this.dom.header.rightBlocker=(b=function(t,e,o){var i;return null!==(o=o===v?0===(i=m("div.dtfc-"+t+"-"+e+"-blocker")).length?null:i.clone().css("z-index",1):o)&&("in"===f||"below"===f?o.appendTo("body").css({top:("top"===e?u:g).offset.top,left:"right"===t?n+d-o.width():n}):o.detach()),o})("right","top",this.dom.header.rightBlocker),this.dom.header.leftBlocker=b("left","top",this.dom.header.leftBlocker),this.dom.footer.rightBlocker=b("right","bottom",this.dom.footer.rightBlocker),this.dom.footer.leftBlocker=b("left","bottom",this.dom.footer.leftBlocker)))},_scrollEnabled:function(){var t=this.s.dt.settings()[0].oScroll;return""!==t.sY||""!==t.sX}}),s.version="3.3.0",s.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0},m.fn.dataTable.FixedHeader=s,m.fn.DataTable.FixedHeader=s,m(x).on("init.dt.dtfh",function(t,e,o){var i;"dt"===t.namespace&&(t=e.oInit.fixedHeader,i=r.defaults.fixedHeader,!t&&!i||e._fixedHeader||(i=m.extend({},i,t),!1!==t&&new s(e,i)))}),r.Api.register("fixedHeader()",function(){}),r.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.update()})}),r.Api.register("fixedHeader.enable()",function(e){return this.iterator("table",function(t){t=t._fixedHeader;e=e===v||e,t&&e!==t.enabled()&&t.enable(e)})}),r.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var t=this.context[0]._fixedHeader;if(t)return t.enabled()}return!1}),r.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.enabled()&&t.enable(!1)})}),m.each(["header","footer"],function(t,o){r.Api.register("fixedHeader."+o+"Offset()",function(e){var t=this.context;return e===v?t.length&&t[0]._fixedHeader?t[0]._fixedHeader[o+"Offset"]():v:this.iterator("table",function(t){t=t._fixedHeader;t&&t[o+"Offset"](e)})})}),r}); \ No newline at end of file diff --git a/js/dataTables.fixedHeader.min.mjs b/js/dataTables.fixedHeader.min.mjs index 6f0dd50..21015d5 100644 --- a/js/dataTables.fixedHeader.min.mjs +++ b/js/dataTables.fixedHeader.min.mjs @@ -1,4 +1,4 @@ -/*! FixedHeader 3.2.4 +/*! FixedHeader 3.3.0 * ©2009-2022 SpryMedia Ltd - datatables.net/license */ -import $ from"jquery";import DataTable from"datatables.net";var _instCounter=0,FixedHeader=function(t,e){if(!(this instanceof FixedHeader))throw"FixedHeader must be initialised with the 'new' keyword.";!0===e&&(e={}),t=new DataTable.Api(t),this.c=$.extend(!0,{},FixedHeader.defaults,e),this.s={dt:t,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:$(window).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:t.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+_instCounter++,scrollLeft:{header:-1,footer:-1},enable:!0},this.dom={floatingHeader:null,thead:$(t.table().header()),tbody:$(t.table().body()),tfoot:$(t.table().footer()),header:{host:null,floating:null,floatingParent:$('
'),placeholder:null},footer:{host:null,floating:null,floatingParent:$('
'),placeholder:null}},this.dom.header.host=this.dom.thead.parent(),this.dom.footer.host=this.dom.tfoot.parent();e=t.settings()[0];if(e._fixedHeader)throw"FixedHeader already initialised on table "+e.nTable.id;(e._fixedHeader=this)._constructor()};$.extend(FixedHeader.prototype,{destroy:function(){var t=this.dom;this.s.dt.off(".dtfc"),$(window).off(this.s.namespace),t.header.rightBlocker&&t.header.rightBlocker.remove(),t.header.leftBlocker&&t.header.leftBlocker.remove(),t.footer.rightBlocker&&t.footer.rightBlocker.remove(),t.footer.leftBlocker&&t.footer.leftBlocker.remove(),this.c.header&&this._modeChange("in-place","header",!0),this.c.footer&&t.tfoot.length&&this._modeChange("in-place","footer",!0)},enable:function(t,e){this.s.enable=t,!e&&void 0!==e||(this._positions(),this._scroll(!0))},enabled:function(){return this.s.enable},headerOffset:function(t){return void 0!==t&&(this.c.headerOffset=t,this.update()),this.c.headerOffset},footerOffset:function(t){return void 0!==t&&(this.c.footerOffset=t,this.update()),this.c.footerOffset},update:function(t){var e;this.s.enable&&(e=this.s.dt.table().node(),$(e).is(":visible")?this.enable(!0,!1):this.enable(!1,!1),0!==$(e).children("thead").length&&(this._positions(),this._scroll(void 0===t||t)))},_constructor:function(){var o=this,i=this.s.dt,t=($(window).on("scroll"+this.s.namespace,function(){o._scroll()}).on("resize"+this.s.namespace,DataTable.util.throttle(function(){o.s.position.windowHeight=$(window).height(),o.update()},50)),$(".fh-fixedHeader")),t=(!this.c.headerOffset&&t.length&&(this.c.headerOffset=t.outerHeight()),$(".fh-fixedFooter"));!this.c.footerOffset&&t.length&&(this.c.footerOffset=t.outerHeight()),i.on("column-reorder.dt.dtfc column-visibility.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(t,e){o.update()}).on("draw.dt.dtfc",function(t,e){o.update(e!==i.settings()[0])}),i.on("destroy.dtfc",function(){o.destroy()}),this._positions(),this._scroll()},_clone:function(t,e){var o,i,s,d,a=this,r=this.s.dt,n=this.dom[t],h="header"===t?this.dom.thead:this.dom.tfoot;"footer"===t&&this._scrollEnabled()||(!e&&n.floating?n.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(e=$(document).scrollLeft(),o=$(document).scrollTop(),n.floating&&(null!==n.placeholder&&n.placeholder.remove(),this._unsize(t),n.floating.children().detach(),n.floating.remove()),i=$(r.table().node()),s=$(i.parent()),d=this._scrollEnabled(),n.floating=$(r.table().node().cloneNode(!1)).attr("aria-hidden","true").css({"table-layout":"fixed",top:0,left:0}).removeAttr("id").append(h),n.floatingParent.css({width:s.width(),overflow:"hidden",height:"fit-content",position:"fixed",left:d?i.offset().left+s.scrollLeft():0}).css("header"===t?{top:this.c.headerOffset,bottom:""}:{top:"",bottom:this.c.footerOffset}).addClass("footer"===t?"dtfh-floatingparentfoot":"dtfh-floatingparenthead").append(n.floating).appendTo("body"),this._stickyPosition(n.floating,"-"),(r=function(){var t=s.scrollLeft();a.s.scrollLeft={footer:t,header:t},n.floatingParent.scrollLeft(a.s.scrollLeft.header)})(),s.off("scroll.dtfh").on("scroll.dtfh",r),n.placeholder=h.clone(!1),n.placeholder.find("*[id]").removeAttr("id"),n.host.prepend(n.placeholder),this._matchWidths(n.placeholder,n.floating),$(document).scrollTop(o).scrollLeft(e)))},_stickyPosition:function(t,i){var s,d;this._scrollEnabled()&&(d="rtl"===$((s=this).s.dt.table().node()).css("direction"),t.find("th").each(function(){var t,e,o;"sticky"===$(this).css("position")&&(t=$(this).css("right"),e=$(this).css("left"),"auto"===t||d?"auto"!==e&&d&&(o=+e.replace(/px/g,"")+("-"===i?-1:1)*s.s.dt.settings()[0].oBrowser.barWidth,$(this).css("left",0m&&s+this.c.headerOffset+p.theadHeightc||void 0===this.dom.header.floatingParent?t=!0:this.dom.header.floatingParent.css({top:this.c.headerOffset,position:"fixed"}).append(this.dom.header.floating)):h="below",!t&&h===this.s.headerMode||this._modeChange(h,"header",t),this._horizontal("header",i)),g={offset:{top:0,left:0},height:0},u={offset:{top:0,left:0},height:0},this.c.footer&&this.dom.tfoot.length&&(!this.s.enable||!p.visible||p.tfootBottom+this.c.footerOffset<=n?d="in-place":c+p.tfootHeight+this.c.footerOffset>n&&m+this.c.footerOffsets&&(p=n+((c=s-o.top)>-g.height?c:0)-(g.offset.top+(c<-g.height?g.height:0)+u.height),f.outerHeight(p=p<0?0:p),Math.round(f.outerHeight())>=Math.round(p)?$(this.dom.tfoot.parent()).addClass("fixedHeader-floating"):$(this.dom.tfoot.parent()).removeClass("fixedHeader-floating"))),this.dom.header.floating&&this.dom.header.floatingParent.css("left",a-i),this.dom.footer.floating&&this.dom.footer.floatingParent.css("left",a-i),void 0!==this.s.dt.settings()[0]._fixedColumns&&(this.dom.header.rightBlocker=(m=function(t,e,o){var i;return null!==(o=void 0===o?0===(i=$("div.dtfc-"+t+"-"+e+"-blocker")).length?null:i.clone().css("z-index",1):o)&&("in"===h||"below"===h?o.appendTo("body").css({top:("top"===e?g:u).offset.top,left:"right"===t?a+r-o.width():a}):o.detach()),o})("right","top",this.dom.header.rightBlocker),this.dom.header.leftBlocker=m("left","top",this.dom.header.leftBlocker),this.dom.footer.rightBlocker=m("right","bottom",this.dom.footer.rightBlocker),this.dom.footer.leftBlocker=m("left","bottom",this.dom.footer.leftBlocker)))},_scrollEnabled:function(){var t=this.s.dt.settings()[0].oScroll;return""!==t.sY||""!==t.sX}}),FixedHeader.version="3.2.4",FixedHeader.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0},$.fn.dataTable.FixedHeader=FixedHeader,$.fn.DataTable.FixedHeader=FixedHeader,$(document).on("init.dt.dtfh",function(t,e,o){var i;"dt"===t.namespace&&(t=e.oInit.fixedHeader,i=DataTable.defaults.fixedHeader,!t&&!i||e._fixedHeader||(i=$.extend({},i,t),!1!==t&&new FixedHeader(e,i)))}),DataTable.Api.register("fixedHeader()",function(){}),DataTable.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.update()})}),DataTable.Api.register("fixedHeader.enable()",function(e){return this.iterator("table",function(t){t=t._fixedHeader;e=void 0===e||e,t&&e!==t.enabled()&&t.enable(e)})}),DataTable.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var t=this.context[0]._fixedHeader;if(t)return t.enabled()}return!1}),DataTable.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.enabled()&&t.enable(!1)})}),$.each(["header","footer"],function(t,o){DataTable.Api.register("fixedHeader."+o+"Offset()",function(e){var t=this.context;return void 0===e?t.length&&t[0]._fixedHeader?t[0]._fixedHeader[o+"Offset"]():void 0:this.iterator("table",function(t){t=t._fixedHeader;t&&t[o+"Offset"](e)})})});export default DataTable; \ No newline at end of file +import $ from"jquery";import DataTable from"datatables.net";var _instCounter=0,FixedHeader=function(t,e){if(!(this instanceof FixedHeader))throw"FixedHeader must be initialised with the 'new' keyword.";!0===e&&(e={}),t=new DataTable.Api(t),this.c=$.extend(!0,{},FixedHeader.defaults,e),this.s={dt:t,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:$(window).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:t.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+_instCounter++,scrollLeft:{header:-1,footer:-1},enable:!0},this.dom={floatingHeader:null,thead:$(t.table().header()),tbody:$(t.table().body()),tfoot:$(t.table().footer()),header:{host:null,floating:null,floatingParent:$('
'),placeholder:null},footer:{host:null,floating:null,floatingParent:$('
'),placeholder:null}},this.dom.header.host=this.dom.thead.parent(),this.dom.footer.host=this.dom.tfoot.parent();e=t.settings()[0];if(e._fixedHeader)throw"FixedHeader already initialised on table "+e.nTable.id;(e._fixedHeader=this)._constructor()};$.extend(FixedHeader.prototype,{destroy:function(){var t=this.dom;this.s.dt.off(".dtfc"),$(window).off(this.s.namespace),t.header.rightBlocker&&t.header.rightBlocker.remove(),t.header.leftBlocker&&t.header.leftBlocker.remove(),t.footer.rightBlocker&&t.footer.rightBlocker.remove(),t.footer.leftBlocker&&t.footer.leftBlocker.remove(),this.c.header&&this._modeChange("in-place","header",!0),this.c.footer&&t.tfoot.length&&this._modeChange("in-place","footer",!0)},enable:function(t,e){this.s.enable=t,!e&&void 0!==e||(this._positions(),this._scroll(!0))},enabled:function(){return this.s.enable},headerOffset:function(t){return void 0!==t&&(this.c.headerOffset=t,this.update()),this.c.headerOffset},footerOffset:function(t){return void 0!==t&&(this.c.footerOffset=t,this.update()),this.c.footerOffset},update:function(t){var e;this.s.enable&&(e=this.s.dt.table().node(),$(e).is(":visible")?this.enable(!0,!1):this.enable(!1,!1),0!==$(e).children("thead").length&&(this._positions(),this._scroll(void 0===t||t)))},_constructor:function(){var o=this,i=this.s.dt,t=($(window).on("scroll"+this.s.namespace,function(){o._scroll()}).on("resize"+this.s.namespace,DataTable.util.throttle(function(){o.s.position.windowHeight=$(window).height(),o.update()},50)),$(".fh-fixedHeader")),t=(!this.c.headerOffset&&t.length&&(this.c.headerOffset=t.outerHeight()),$(".fh-fixedFooter"));!this.c.footerOffset&&t.length&&(this.c.footerOffset=t.outerHeight()),i.on("column-reorder.dt.dtfc column-visibility.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(t,e){o.update()}).on("draw.dt.dtfc",function(t,e){o.update(e!==i.settings()[0])}),i.on("destroy.dtfc",function(){o.destroy()}),this._positions(),this._scroll()},_clone:function(t,e){var o,i,s,d,a=this,r=this.s.dt,n=this.dom[t],h="header"===t?this.dom.thead:this.dom.tfoot;"footer"===t&&this._scrollEnabled()||(!e&&n.floating?n.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(e=$(document).scrollLeft(),o=$(document).scrollTop(),n.floating&&(null!==n.placeholder&&n.placeholder.remove(),this._unsize(t),n.floating.children().detach(),n.floating.remove()),i=$(r.table().node()),s=$(i.parent()),d=this._scrollEnabled(),n.floating=$(r.table().node().cloneNode(!1)).attr("aria-hidden","true").css({"table-layout":"fixed",top:0,left:0}).removeAttr("id").append(h),n.floatingParent.css({width:s.width(),overflow:"hidden",height:"fit-content",position:"fixed",left:d?i.offset().left+s.scrollLeft():0}).css("header"===t?{top:this.c.headerOffset,bottom:""}:{top:"",bottom:this.c.footerOffset}).addClass("footer"===t?"dtfh-floatingparentfoot":"dtfh-floatingparenthead").append(n.floating).appendTo("body"),this._stickyPosition(n.floating,"-"),(r=function(){var t=s.scrollLeft();a.s.scrollLeft={footer:t,header:t},n.floatingParent.scrollLeft(a.s.scrollLeft.header)})(),s.off("scroll.dtfh").on("scroll.dtfh",r),n.placeholder=h.clone(!1),n.placeholder.find("*[id]").removeAttr("id"),n.host.prepend(n.placeholder),this._matchWidths(n.placeholder,n.floating),$(document).scrollTop(o).scrollLeft(e)))},_stickyPosition:function(t,i){var s,d;this._scrollEnabled()&&(d="rtl"===$((s=this).s.dt.table().node()).css("direction"),t.find("th").each(function(){var t,e,o;"sticky"===$(this).css("position")&&(t=$(this).css("right"),e=$(this).css("left"),"auto"===t||d?"auto"!==e&&d&&(o=+e.replace(/px/g,"")+("-"===i?-1:1)*s.s.dt.settings()[0].oBrowser.barWidth,$(this).css("left",0m&&s+this.c.headerOffset+p.theadHeightc||void 0===this.dom.header.floatingParent?t=!0:this.dom.header.floatingParent.css({top:this.c.headerOffset,position:"fixed"}).append(this.dom.header.floating)):h="below",!t&&h===this.s.headerMode||this._modeChange(h,"header",t),this._horizontal("header",i)),g={offset:{top:0,left:0},height:0},u={offset:{top:0,left:0},height:0},this.c.footer&&this.dom.tfoot.length&&(!this.s.enable||!p.visible||p.tfootBottom+this.c.footerOffset<=n?d="in-place":c+p.tfootHeight+this.c.footerOffset>n&&m+this.c.footerOffsets&&(p=n+((c=s-o.top)>-g.height?c:0)-(g.offset.top+(c<-g.height?g.height:0)+u.height),f.outerHeight(p=p<0?0:p),Math.round(f.outerHeight())>=Math.round(p)?$(this.dom.tfoot.parent()).addClass("fixedHeader-floating"):$(this.dom.tfoot.parent()).removeClass("fixedHeader-floating"))),this.dom.header.floating&&this.dom.header.floatingParent.css("left",a-i),this.dom.footer.floating&&this.dom.footer.floatingParent.css("left",a-i),void 0!==this.s.dt.settings()[0]._fixedColumns&&(this.dom.header.rightBlocker=(m=function(t,e,o){var i;return null!==(o=void 0===o?0===(i=$("div.dtfc-"+t+"-"+e+"-blocker")).length?null:i.clone().css("z-index",1):o)&&("in"===h||"below"===h?o.appendTo("body").css({top:("top"===e?g:u).offset.top,left:"right"===t?a+r-o.width():a}):o.detach()),o})("right","top",this.dom.header.rightBlocker),this.dom.header.leftBlocker=m("left","top",this.dom.header.leftBlocker),this.dom.footer.rightBlocker=m("right","bottom",this.dom.footer.rightBlocker),this.dom.footer.leftBlocker=m("left","bottom",this.dom.footer.leftBlocker)))},_scrollEnabled:function(){var t=this.s.dt.settings()[0].oScroll;return""!==t.sY||""!==t.sX}}),FixedHeader.version="3.3.0",FixedHeader.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0},$.fn.dataTable.FixedHeader=FixedHeader,$.fn.DataTable.FixedHeader=FixedHeader,$(document).on("init.dt.dtfh",function(t,e,o){var i;"dt"===t.namespace&&(t=e.oInit.fixedHeader,i=DataTable.defaults.fixedHeader,!t&&!i||e._fixedHeader||(i=$.extend({},i,t),!1!==t&&new FixedHeader(e,i)))}),DataTable.Api.register("fixedHeader()",function(){}),DataTable.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.update()})}),DataTable.Api.register("fixedHeader.enable()",function(e){return this.iterator("table",function(t){t=t._fixedHeader;e=void 0===e||e,t&&e!==t.enabled()&&t.enable(e)})}),DataTable.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var t=this.context[0]._fixedHeader;if(t)return t.enabled()}return!1}),DataTable.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(t){t=t._fixedHeader;t&&t.enabled()&&t.enable(!1)})}),$.each(["header","footer"],function(t,o){DataTable.Api.register("fixedHeader."+o+"Offset()",function(e){var t=this.context;return void 0===e?t.length&&t[0]._fixedHeader?t[0]._fixedHeader[o+"Offset"]():void 0:this.iterator("table",function(t){t=t._fixedHeader;t&&t[o+"Offset"](e)})})});export default DataTable; \ No newline at end of file diff --git a/js/dataTables.fixedHeader.mjs b/js/dataTables.fixedHeader.mjs index 15e2156..2a4698d 100644 --- a/js/dataTables.fixedHeader.mjs +++ b/js/dataTables.fixedHeader.mjs @@ -1,5 +1,5 @@ -/*! FixedHeader 3.2.4 +/*! FixedHeader 3.3.0 * ©2009-2022 SpryMedia Ltd - datatables.net/license */ @@ -12,7 +12,7 @@ import DataTable from 'datatables.net'; * @summary FixedHeader * @description Fix a table's header or footer, so it is always visible while * scrolling - * @version 3.2.4 + * @version 3.3.0 * @author SpryMedia Ltd (www.sprymedia.co.uk) * @contact www.sprymedia.co.uk * @copyright SpryMedia Ltd. @@ -948,7 +948,7 @@ $.extend( FixedHeader.prototype, { * @type {String} * @static */ -FixedHeader.version = "3.2.4"; +FixedHeader.version = "3.3.0"; /** * Defaults