LocalCDN-Firefox-Chrome-Brave/resources/datatables/1.10.24/dataTables.fixedHeader.min.jsm

36 lines
9.9 KiB
JavaScript

/*!
Copyright 2009-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
FixedHeader 3.1.8
©2009-2021 SpryMedia Ltd - datatables.net/license
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,e,f){c instanceof String&&(c=String(c));for(var k=c.length,h=0;h<k;h++){var n=c[h];if(e.call(f,n,h,c))return{i:h,v:n}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,e,f){if(c==Array.prototype||c==Object.prototype)return c;c[e]=f.value;return c};$jscomp.getGlobal=function(c){c=["object"==typeof globalThis&&globalThis,c,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var e=0;e<c.length;++e){var f=c[e];if(f&&f.Math==Math)return f}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(c,e){var f=$jscomp.propertyToPolyfillSymbol[e];if(null==f)return c[e];f=c[f];return void 0!==f?f:c[e]};
$jscomp.polyfill=function(c,e,f,k){e&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(c,e,f,k):$jscomp.polyfillUnisolated(c,e,f,k))};$jscomp.polyfillUnisolated=function(c,e,f,k){f=$jscomp.global;c=c.split(".");for(k=0;k<c.length-1;k++){var h=c[k];if(!(h in f))return;f=f[h]}c=c[c.length-1];k=f[c];e=e(k);e!=k&&null!=e&&$jscomp.defineProperty(f,c,{configurable:!0,writable:!0,value:e})};
$jscomp.polyfillIsolated=function(c,e,f,k){var h=c.split(".");c=1===h.length;k=h[0];k=!c&&k in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var n=0;n<h.length-1;n++){var m=h[n];if(!(m in k))return;k=k[m]}h=h[h.length-1];f=$jscomp.IS_SYMBOL_NATIVE&&"es6"===f?k[h]:null;e=e(f);null!=e&&(c?$jscomp.defineProperty($jscomp.polyfills,h,{configurable:!0,writable:!0,value:e}):e!==f&&($jscomp.propertyToPolyfillSymbol[h]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(h):$jscomp.POLYFILL_PREFIX+h,h=
$jscomp.propertyToPolyfillSymbol[h],$jscomp.defineProperty(k,h,{configurable:!0,writable:!0,value:e})))};$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(e,f){return $jscomp.findInternal(this,e,f).v}},"es6","es3");
(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return c(e,window,document)}):"object"===typeof exports?module.exports=function(e,f){e||(e=window);f&&f.fn.dataTable||(f=require("datatables.net")(e,f).$);return c(f,e,e.document)}:c(jQuery,window,document)})(function(c,e,f,k){var h=c.fn.dataTable,n=0,m=function(a,b){if(!(this instanceof m))throw"FixedHeader must be initialised with the 'new' keyword.";!0===b&&(b={});a=new h.Api(a);this.c=c.extend(!0,
{},m.defaults,b);this.s={dt:a,position:{theadTop:0,tbodyTop:0,tfootTop:0,tfootBottom:0,width:0,left:0,tfootHeight:0,theadHeight:0,windowHeight:c(e).height(),visible:!0},headerMode:null,footerMode:null,autoWidth:a.settings()[0].oFeatures.bAutoWidth,namespace:".dtfc"+n++,scrollLeft:{header:-1,footer:-1},enable:!0};this.dom={floatingHeader:null,thead:c(a.table().header()),tbody:c(a.table().body()),tfoot:c(a.table().footer()),header:{host:null,floating:null,placeholder:null},footer:{host:null,floating:null,
placeholder:null}};this.dom.header.host=this.dom.thead.parent();this.dom.footer.host=this.dom.tfoot.parent();a=a.settings()[0];if(a._fixedHeader)throw"FixedHeader already initialised on table "+a.nTable.id;a._fixedHeader=this;this._constructor()};c.extend(m.prototype,{destroy:function(){this.s.dt.off(".dtfc");c(e).off(this.s.namespace);this.c.header&&this._modeChange("in-place","header",!0);this.c.footer&&this.dom.tfoot.length&&this._modeChange("in-place","footer",!0)},enable:function(a,b){this.s.enable=
a;if(b||b===k)this._positions(),this._scroll(!0)},enabled:function(){return this.s.enable},headerOffset:function(a){a!==k&&(this.c.headerOffset=a,this.update());return this.c.headerOffset},footerOffset:function(a){a!==k&&(this.c.footerOffset=a,this.update());return this.c.footerOffset},update:function(){var a=this.s.dt.table().node();c(a).is(":visible")?this.enable(!0,!1):this.enable(!1,!1);this._positions();this._scroll(!0)},_constructor:function(){var a=this,b=this.s.dt;c(e).on("scroll"+this.s.namespace,
function(){a._scroll()}).on("resize"+this.s.namespace,h.util.throttle(function(){a.s.position.windowHeight=c(e).height();a.update()},50));var g=c(".fh-fixedHeader");!this.c.headerOffset&&g.length&&(this.c.headerOffset=g.outerHeight());g=c(".fh-fixedFooter");!this.c.footerOffset&&g.length&&(this.c.footerOffset=g.outerHeight());b.on("column-reorder.dt.dtfc column-visibility.dt.dtfc draw.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc",function(){a.update()});b.on("destroy.dtfc",function(){a.destroy()});
this._positions();this._scroll()},_clone:function(a,b){var g=this.s.dt,d=this.dom[a],l="header"===a?this.dom.thead:this.dom.tfoot;!b&&d.floating?d.floating.removeClass("fixedHeader-floating fixedHeader-locked"):(d.floating&&(d.placeholder.remove(),this._unsize(a),d.floating.children().detach(),d.floating.remove()),d.floating=c(g.table().node().cloneNode(!1)).css("table-layout","fixed").attr("aria-hidden","true").removeAttr("id").append(l).appendTo("body"),d.placeholder=l.clone(!1),d.placeholder.find("*[id]").removeAttr("id"),
d.host.prepend(d.placeholder),this._matchWidths(d.placeholder,d.floating))},_matchWidths:function(a,b){var g=function(q){return c(q,a).map(function(){return 1*c(this).css("width").replace(/[^\d\.]/g,"")}).toArray()},d=function(q,r){c(q,b).each(function(p){c(this).css({width:r[p],minWidth:r[p]})})},l=g("th");g=g("td");d("th",l);d("td",g)},_unsize:function(a){var b=this.dom[a].floating;b&&("footer"===a||"header"===a&&!this.s.autoWidth)?c("th, td",b).css({width:"",minWidth:""}):b&&"header"===a&&c("th, td",
b).css("min-width","")},_horizontal:function(a,b){var g=this.dom[a],d=this.s.position,l=this.s.scrollLeft;g.floating&&l[a]!==b&&(g.floating.css("left",d.left-b),l[a]=b)},_modeChange:function(a,b,g){var d=this.dom[b],l=this.s.position,q=function(t){d.floating.attr("style",function(v,u){return(u||"")+"width: "+t+"px !important;"})},r=this.dom["footer"===b?"tfoot":"thead"],p=c.contains(r[0],f.activeElement)?f.activeElement:null;p&&p.blur();"in-place"===a?(d.placeholder&&(d.placeholder.remove(),d.placeholder=
null),this._unsize(b),"header"===b?d.host.prepend(r):d.host.append(r),d.floating&&(d.floating.remove(),d.floating=null)):"in"===a?(this._clone(b,g),d.floating.addClass("fixedHeader-floating").css("header"===b?"top":"bottom",this.c[b+"Offset"]).css("left",l.left+"px"),q(l.width),"footer"===b&&d.floating.css("top","")):"below"===a?(this._clone(b,g),d.floating.addClass("fixedHeader-locked").css("top",l.tfootTop-l.theadHeight).css("left",l.left+"px"),q(l.width)):"above"===a&&(this._clone(b,g),d.floating.addClass("fixedHeader-locked").css("top",
l.tbodyTop).css("left",l.left+"px"),q(l.width));p&&p!==f.activeElement&&setTimeout(function(){p.focus()},10);this.s.scrollLeft.header=-1;this.s.scrollLeft.footer=-1;this.s[b+"Mode"]=a},_positions:function(){var a=this.s.dt.table(),b=this.s.position,g=this.dom;a=c(a.node());var d=a.children("thead"),l=a.children("tfoot");g=g.tbody;b.visible=a.is(":visible");b.width=a.outerWidth();b.left=a.offset().left;b.theadTop=d.offset().top;b.tbodyTop=g.offset().top;b.tbodyHeight=g.outerHeight();b.theadHeight=
b.tbodyTop-b.theadTop;l.length?(b.tfootTop=l.offset().top,b.tfootBottom=b.tfootTop+l.outerHeight(),b.tfootHeight=b.tfootBottom-b.tfootTop):(b.tfootTop=b.tbodyTop+g.outerHeight(),b.tfootBottom=b.tfootTop,b.tfootHeight=b.tfootTop)},_scroll:function(a){var b=c(f).scrollTop(),g=c(f).scrollLeft(),d=this.s.position;if(this.c.header){var l=this.s.enable?!d.visible||b<=d.theadTop-this.c.headerOffset?"in-place":b<=d.tfootTop-d.theadHeight-this.c.headerOffset?"in":"below":"in-place";(a||l!==this.s.headerMode)&&
this._modeChange(l,"header",a);this._horizontal("header",g)}this.c.footer&&this.dom.tfoot.length&&(b=this.s.enable?!d.visible||b+d.windowHeight>=d.tfootBottom+this.c.footerOffset?"in-place":d.windowHeight+b>d.tbodyTop+d.tfootHeight+this.c.footerOffset?"in":"above":"in-place",(a||b!==this.s.footerMode)&&this._modeChange(b,"footer",a),this._horizontal("footer",g))}});m.version="3.1.8";m.defaults={header:!0,footer:!1,headerOffset:0,footerOffset:0};c.fn.dataTable.FixedHeader=m;c.fn.DataTable.FixedHeader=
m;c(f).on("init.dt.dtfh",function(a,b,g){"dt"===a.namespace&&(a=b.oInit.fixedHeader,g=h.defaults.fixedHeader,!a&&!g||b._fixedHeader||(g=c.extend({},g,a),!1!==a&&new m(b,g)))});h.Api.register("fixedHeader()",function(){});h.Api.register("fixedHeader.adjust()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.update()})});h.Api.register("fixedHeader.enable()",function(a){return this.iterator("table",function(b){b=b._fixedHeader;a=a!==k?a:!0;b&&a!==b.enabled()&&b.enable(a)})});
h.Api.register("fixedHeader.enabled()",function(){if(this.context.length){var a=this.context[0]._fixedHeader;if(a)return a.enabled()}return!1});h.Api.register("fixedHeader.disable()",function(){return this.iterator("table",function(a){(a=a._fixedHeader)&&a.enabled()&&a.enable(!1)})});c.each(["header","footer"],function(a,b){h.Api.register("fixedHeader."+b+"Offset()",function(g){var d=this.context;return g===k?d.length&&d[0]._fixedHeader?d[0]._fixedHeader[b+"Offset"]():k:this.iterator("table",function(l){if(l=
l._fixedHeader)l[b+"Offset"](g)})})});return m});