mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
NPM libs: Update embedded package to avoid their dependencies to be retrieved as they are already their
This commit is contained in:
138
node_modules/datatables.net-fixedheader/js/dataTables.fixedHeader.js
generated
vendored
138
node_modules/datatables.net-fixedheader/js/dataTables.fixedHeader.js
generated
vendored
@@ -1,16 +1,16 @@
|
||||
/*! FixedHeader 3.1.2
|
||||
* ©2009-2016 SpryMedia Ltd - datatables.net/license
|
||||
/*! FixedHeader 3.1.8
|
||||
* ©2009-2021 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @summary FixedHeader
|
||||
* @description Fix a table's header or footer, so it is always visible while
|
||||
* scrolling
|
||||
* @version 3.1.2
|
||||
* @version 3.1.8
|
||||
* @file dataTables.fixedHeader.js
|
||||
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
||||
* @contact www.sprymedia.co.uk/contact
|
||||
* @copyright Copyright 2009-2016 SpryMedia Ltd.
|
||||
* @copyright Copyright 2009-2021 SpryMedia Ltd.
|
||||
*
|
||||
* This source file is free software, available under the following license:
|
||||
* MIT license - http://datatables.net/license/mit
|
||||
@@ -134,15 +134,13 @@ $.extend( FixedHeader.prototype, {
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* API methods
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Enable / disable the fixed elements
|
||||
*
|
||||
* @param {boolean} enable `true` to enable, `false` to disable
|
||||
* Kill off FH and any events
|
||||
*/
|
||||
enable: function ( enable )
|
||||
{
|
||||
this.s.enable = enable;
|
||||
destroy: function () {
|
||||
this.s.dt.off( '.dtfc' );
|
||||
$(window).off( this.s.namespace );
|
||||
|
||||
if ( this.c.header ) {
|
||||
this._modeChange( 'in-place', 'header', true );
|
||||
@@ -151,8 +149,29 @@ $.extend( FixedHeader.prototype, {
|
||||
if ( this.c.footer && this.dom.tfoot.length ) {
|
||||
this._modeChange( 'in-place', 'footer', true );
|
||||
}
|
||||
},
|
||||
|
||||
this.update();
|
||||
/**
|
||||
* Enable / disable the fixed elements
|
||||
*
|
||||
* @param {boolean} enable `true` to enable, `false` to disable
|
||||
*/
|
||||
enable: function ( enable, update )
|
||||
{
|
||||
this.s.enable = enable;
|
||||
|
||||
if ( update || update === undefined ) {
|
||||
this._positions();
|
||||
this._scroll( true );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get enabled status
|
||||
*/
|
||||
enabled: function ()
|
||||
{
|
||||
return this.s.enable;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -191,6 +210,15 @@ $.extend( FixedHeader.prototype, {
|
||||
*/
|
||||
update: function ()
|
||||
{
|
||||
var table = this.s.dt.table().node();
|
||||
|
||||
if ( $(table).is(':visible') ) {
|
||||
this.enable( true, false );
|
||||
}
|
||||
else {
|
||||
this.enable( false, false );
|
||||
}
|
||||
|
||||
this._positions();
|
||||
this._scroll( true );
|
||||
},
|
||||
@@ -215,10 +243,10 @@ $.extend( FixedHeader.prototype, {
|
||||
.on( 'scroll'+this.s.namespace, function () {
|
||||
that._scroll();
|
||||
} )
|
||||
.on( 'resize'+this.s.namespace, function () {
|
||||
.on( 'resize'+this.s.namespace, DataTable.util.throttle( function () {
|
||||
that.s.position.windowHeight = $(window).height();
|
||||
that.update();
|
||||
} );
|
||||
}, 50 ) );
|
||||
|
||||
var autoHeader = $('.fh-fixedHeader');
|
||||
if ( ! this.c.headerOffset && autoHeader.length ) {
|
||||
@@ -230,13 +258,12 @@ $.extend( FixedHeader.prototype, {
|
||||
this.c.footerOffset = autoFooter.outerHeight();
|
||||
}
|
||||
|
||||
dt.on( 'column-reorder.dt.dtfc column-visibility.dt.dtfc draw.dt.dtfc column-sizing.dt.dtfc', function () {
|
||||
dt.on( 'column-reorder.dt.dtfc column-visibility.dt.dtfc draw.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc', function () {
|
||||
that.update();
|
||||
} );
|
||||
|
||||
dt.on( 'destroy.dtfc', function () {
|
||||
dt.off( '.dtfc' );
|
||||
$(window).off( that.s.namespace );
|
||||
that.destroy();
|
||||
} );
|
||||
|
||||
this._positions();
|
||||
@@ -280,12 +307,17 @@ $.extend( FixedHeader.prototype, {
|
||||
|
||||
itemDom.floating = $( dt.table().node().cloneNode( false ) )
|
||||
.css( 'table-layout', 'fixed' )
|
||||
.attr( 'aria-hidden', 'true' )
|
||||
.removeAttr( 'id' )
|
||||
.append( itemElement )
|
||||
.appendTo( 'body' );
|
||||
|
||||
// Insert a fake thead/tfoot into the DataTable to stop it jumping around
|
||||
itemDom.placeholder = itemElement.clone( false );
|
||||
itemDom.placeholder
|
||||
.find( '*[id]' )
|
||||
.removeAttr( 'id' );
|
||||
|
||||
itemDom.host.prepend( itemDom.placeholder );
|
||||
|
||||
// Clone widths
|
||||
@@ -308,7 +340,7 @@ $.extend( FixedHeader.prototype, {
|
||||
var get = function ( name ) {
|
||||
return $(name, from)
|
||||
.map( function () {
|
||||
return $(this).width();
|
||||
return $(this).css('width').replace(/[^\d\.]/g, '') * 1;
|
||||
} ).toArray();
|
||||
};
|
||||
|
||||
@@ -393,12 +425,23 @@ $.extend( FixedHeader.prototype, {
|
||||
var itemDom = this.dom[ item ];
|
||||
var position = this.s.position;
|
||||
|
||||
// It isn't trivial to add a !important css attribute...
|
||||
var importantWidth = function (w) {
|
||||
itemDom.floating.attr('style', function(i,s) {
|
||||
return (s || '') + 'width: '+w+'px !important;';
|
||||
});
|
||||
};
|
||||
|
||||
// Record focus. Browser's will cause input elements to loose focus if
|
||||
// they are inserted else where in the doc
|
||||
var tablePart = this.dom[ item==='footer' ? 'tfoot' : 'thead' ];
|
||||
var focus = $.contains( tablePart[0], document.activeElement ) ?
|
||||
document.activeElement :
|
||||
null;
|
||||
|
||||
if ( focus ) {
|
||||
focus.blur();
|
||||
}
|
||||
|
||||
if ( mode === 'in-place' ) {
|
||||
// Insert the header back into the table's real header
|
||||
@@ -410,10 +453,10 @@ $.extend( FixedHeader.prototype, {
|
||||
this._unsize( item );
|
||||
|
||||
if ( item === 'header' ) {
|
||||
itemDom.host.prepend( this.dom.thead );
|
||||
itemDom.host.prepend( tablePart );
|
||||
}
|
||||
else {
|
||||
itemDom.host.append( this.dom.tfoot );
|
||||
itemDom.host.append( tablePart );
|
||||
}
|
||||
|
||||
if ( itemDom.floating ) {
|
||||
@@ -429,8 +472,9 @@ $.extend( FixedHeader.prototype, {
|
||||
itemDom.floating
|
||||
.addClass( 'fixedHeader-floating' )
|
||||
.css( item === 'header' ? 'top' : 'bottom', this.c[item+'Offset'] )
|
||||
.css( 'left', position.left+'px' )
|
||||
.css( 'width', position.width+'px' );
|
||||
.css( 'left', position.left+'px' );
|
||||
|
||||
importantWidth(position.width);
|
||||
|
||||
if ( item === 'footer' ) {
|
||||
itemDom.floating.css( 'top', '' );
|
||||
@@ -443,8 +487,9 @@ $.extend( FixedHeader.prototype, {
|
||||
itemDom.floating
|
||||
.addClass( 'fixedHeader-locked' )
|
||||
.css( 'top', position.tfootTop - position.theadHeight )
|
||||
.css( 'left', position.left+'px' )
|
||||
.css( 'width', position.width+'px' );
|
||||
.css( 'left', position.left+'px' );
|
||||
|
||||
importantWidth(position.width);
|
||||
}
|
||||
else if ( mode === 'above' ) { // only used for the footer
|
||||
// Fix the position of the floating footer at top of the table body
|
||||
@@ -453,13 +498,16 @@ $.extend( FixedHeader.prototype, {
|
||||
itemDom.floating
|
||||
.addClass( 'fixedHeader-locked' )
|
||||
.css( 'top', position.tbodyTop )
|
||||
.css( 'left', position.left+'px' )
|
||||
.css( 'width', position.width+'px' );
|
||||
.css( 'left', position.left+'px' );
|
||||
|
||||
importantWidth(position.width);
|
||||
}
|
||||
|
||||
// Restore focus if it was lost
|
||||
if ( focus && focus !== document.activeElement ) {
|
||||
focus.focus();
|
||||
setTimeout( function () {
|
||||
focus.focus();
|
||||
}, 10 );
|
||||
}
|
||||
|
||||
this.s.scrollLeft.header = -1;
|
||||
@@ -493,6 +541,7 @@ $.extend( FixedHeader.prototype, {
|
||||
position.left = tableNode.offset().left;
|
||||
position.theadTop = thead.offset().top;
|
||||
position.tbodyTop = tbody.offset().top;
|
||||
position.tbodyHeight = tbody.outerHeight();
|
||||
position.theadHeight = position.tbodyTop - position.theadTop;
|
||||
|
||||
if ( tfoot.length ) {
|
||||
@@ -523,12 +572,11 @@ $.extend( FixedHeader.prototype, {
|
||||
var position = this.s.position;
|
||||
var headerMode, footerMode;
|
||||
|
||||
if ( ! this.s.enable ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( this.c.header ) {
|
||||
if ( ! position.visible || windowTop <= position.theadTop - this.c.headerOffset ) {
|
||||
if ( ! this.s.enable ) {
|
||||
headerMode = 'in-place';
|
||||
}
|
||||
else if ( ! position.visible || windowTop <= position.theadTop - this.c.headerOffset ) {
|
||||
headerMode = 'in-place';
|
||||
}
|
||||
else if ( windowTop <= position.tfootTop - position.theadHeight - this.c.headerOffset ) {
|
||||
@@ -546,7 +594,10 @@ $.extend( FixedHeader.prototype, {
|
||||
}
|
||||
|
||||
if ( this.c.footer && this.dom.tfoot.length ) {
|
||||
if ( ! position.visible || windowTop + position.windowHeight >= position.tfootBottom + this.c.footerOffset ) {
|
||||
if ( ! this.s.enable ) {
|
||||
footerMode = 'in-place';
|
||||
}
|
||||
else if ( ! position.visible || windowTop + position.windowHeight >= position.tfootBottom + this.c.footerOffset ) {
|
||||
footerMode = 'in-place';
|
||||
}
|
||||
else if ( position.windowHeight + windowTop > position.tbodyTop + position.tfootHeight + this.c.footerOffset ) {
|
||||
@@ -571,7 +622,7 @@ $.extend( FixedHeader.prototype, {
|
||||
* @type {String}
|
||||
* @static
|
||||
*/
|
||||
FixedHeader.version = "3.1.2";
|
||||
FixedHeader.version = "3.1.8";
|
||||
|
||||
/**
|
||||
* Defaults
|
||||
@@ -631,17 +682,30 @@ DataTable.Api.register( 'fixedHeader.enable()', function ( flag ) {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
var fh = ctx._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
fh.enable( flag !== undefined ? flag : true );
|
||||
flag = ( flag !== undefined ? flag : true );
|
||||
if ( fh && flag !== fh.enabled() ) {
|
||||
fh.enable( flag );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
DataTable.Api.register( 'fixedHeader.enabled()', function () {
|
||||
if ( this.context.length ) {
|
||||
var fh = this.context[0]._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
return fh.enabled();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} );
|
||||
|
||||
DataTable.Api.register( 'fixedHeader.disable()', function ( ) {
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
var fh = ctx._fixedHeader;
|
||||
|
||||
if ( fh ) {
|
||||
if ( fh && fh.enabled() ) {
|
||||
fh.enable( false );
|
||||
}
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user