N°7355 - Upgrade datatables.net to 1.13.11 (and plugins)

This commit is contained in:
Molkobain
2024-03-26 11:02:46 +01:00
parent bcfbacc625
commit 12b30c1531
42 changed files with 28058 additions and 5541 deletions

40
node_modules/.package-lock.json generated vendored
View File

@@ -93,46 +93,46 @@
"integrity": "sha512-IUqa8/ntsWQiI1TnPTnzWcwh3bJ6Orurp2LVQne9UJdiDjxeFynUuIwjJjbqsBEu3wrhcVnZblIdd9pvdM5HEQ=="
},
"node_modules/datatables.net": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.11.3.tgz",
"integrity": "sha512-VMj5qEaTebpNurySkM6jy6sGpl+s6onPK8xJhYr296R/vUBnz1+id16NVqNf9z5aR076OGcpGHCuiTuy4E05oQ==",
"version": "1.13.11",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.13.11.tgz",
"integrity": "sha512-AE6RkMXziRaqzPcu/pl3SJXeRa6fmXQG/fVjuRESujvkzqDCYEeKTTpPMuVJSGYJpPi32WGSphVNNY1G4nSN/g==",
"dependencies": {
"jquery": ">=1.7"
"jquery": "1.8 - 4"
}
},
"node_modules/datatables.net-fixedheader": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/datatables.net-fixedheader/-/datatables.net-fixedheader-3.1.8.tgz",
"integrity": "sha512-MLZgzkU6sGNSqlKuuJC/5/ps4xcmJQZILHqr5bOK/2kBEzCZzH+ZVOjudVRshnxkFn7IOTAOecMQHI6HPHFhag==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/datatables.net-fixedheader/-/datatables.net-fixedheader-3.4.1.tgz",
"integrity": "sha512-c9FJAShG5r8RJDIszWQvMFe6Ie+njfbHB9GhzOPjEF7zhbsMUQEkoYq1qW3ppOxY5psadDrT+D3f4iGM589u6w==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
"node_modules/datatables.net-responsive": {
"version": "2.2.7",
"resolved": "https://registry.npmjs.org/datatables.net-responsive/-/datatables.net-responsive-2.2.7.tgz",
"integrity": "sha512-pjZcR+AHa0GE++giRhMBSxFLKrfjP+X7etj7oZMMfMTi1gcdYdM8YP3gmpEyfLjDEg6uPJb9PRH4mQHcc8OYyA==",
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/datatables.net-responsive/-/datatables.net-responsive-2.5.1.tgz",
"integrity": "sha512-hyJb2faIzEWUX5Yn4HOSq/6NNB9SXDVbI4OU9ny+XU/2ghZEz4676spOgzpDHTdWvCfM+t1mbUsT70fDiTTr9w==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
"node_modules/datatables.net-scroller": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/datatables.net-scroller/-/datatables.net-scroller-1.5.1.tgz",
"integrity": "sha512-aMUarBCREmrSLE0n0NBmOMI55Re+EV4KMpR1rMc2l8jhoE+UQWF1Xe0AYuR4342ybesb1WW8U3RVlLdS6gQCmg==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/datatables.net-scroller/-/datatables.net-scroller-2.4.1.tgz",
"integrity": "sha512-zLtAUJUrqrLvBPADjmropapUqwIEtZcFABKgffxx50L4bcJr9yFDG4UctI4bFQJjnoRTU5iSAlyGBCxpxeqHfw==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "1.11 - 2",
"jquery": ">=1.7"
}
},
"node_modules/datatables.net-select": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/datatables.net-select/-/datatables.net-select-1.3.3.tgz",
"integrity": "sha512-M4e9Qx790IPt+tc+CLgk7gPram3i+M2OmhIkhIpp7RcZ2Ay4App4ouQZcEx3j1MTRIWxtOz47xjpWrwVfJ23YQ==",
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/datatables.net-select/-/datatables.net-select-1.7.1.tgz",
"integrity": "sha512-yC+GoBDVsnbaFTYKmZ2v5Bftc66zSZCYHbPYZb/ccdvxytEEudjc9R3wn6fgkOrVx3C2X/8keQc4a7EJvdOErg==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},

View File

@@ -1,3 +1,5 @@
The MIT License (MIT)
Copyright SpryMedia Limited and other contributors
http://datatables.net

View File

@@ -17,11 +17,17 @@ For inclusion of this library using a standard `<script>` tag, rather than using
npm install datatables.net-fixedheader
```
ES3 Syntax
```
var $ = require( 'jquery' );
require( 'datatables.net-fixedheader' )( window, $ );
```
ES6 Syntax
```
import 'datatables.net-fixedheader'
```
### bower
```
@@ -32,8 +38,7 @@ bower install --save datatables.net-fixedheader
## Documentation
Full documentation of the DataTables options, API and plug-in interface are available on the DOCS_LINK. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.
Full documentation and examples for FixedHeader can be found [on the website](https://datatables.net/extensions/fixedheader).
## Bug / Support

View File

@@ -1,25 +1,5 @@
/*! 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.8
* @file dataTables.fixedHeader.js
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
* @copyright 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.4.0
* © SpryMedia Ltd - datatables.net/license
*/
(function( factory ){
@@ -31,18 +11,34 @@
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ || ! $.fn.dataTable ) {
$ = require('datatables.net')(root, $).$;
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
@@ -52,6 +48,26 @@
var DataTable = $.fn.dataTable;
/**
* @summary FixedHeader
* @description Fix a table's header or footer, so it is always visible while
* scrolling
* @version 3.4.0
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk
* @copyright 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
*/
var _instCounter = 0;
var FixedHeader = function (dt, config) {
@@ -86,12 +102,13 @@ var FixedHeader = function ( dt, config ) {
headerMode: null,
footerMode: null,
autoWidth: dt.settings()[0].oFeatures.bAutoWidth,
namespace: '.dtfc'+(_instCounter++),
namespace: '.dtfc' + _instCounter++,
scrollLeft: {
header: -1,
footer: -1
},
enable: true
enable: true,
autoDisable: false
};
this.dom = {
@@ -102,11 +119,13 @@ var FixedHeader = function ( dt, config ) {
header: {
host: null,
floating: null,
floatingParent: $('<div class="dtfh-floatingparent">'),
placeholder: null
},
footer: {
host: null,
floating: null,
floatingParent: $('<div class="dtfh-floatingparent">'),
placeholder: null
}
};
@@ -116,7 +135,7 @@ var FixedHeader = function ( dt, config ) {
var dtSettings = dt.settings()[0];
if (dtSettings._fixedHeader) {
throw "FixedHeader already initialised on table "+dtSettings.nTable.id;
throw 'FixedHeader already initialised on table ' + dtSettings.nTable.id;
}
dtSettings._fixedHeader = this;
@@ -124,7 +143,6 @@ var FixedHeader = function ( dt, config ) {
this._constructor();
};
/*
* Variable: FixedHeader
* Purpose: Prototype for FixedHeader
@@ -139,14 +157,30 @@ $.extend( FixedHeader.prototype, {
* Kill off FH and any events
*/
destroy: function () {
var dom = this.dom;
this.s.dt.off('.dtfc');
$(window).off(this.s.namespace);
// Remove clones of FC blockers
if (dom.header.rightBlocker) {
dom.header.rightBlocker.remove();
}
if (dom.header.leftBlocker) {
dom.header.leftBlocker.remove();
}
if (dom.footer.rightBlocker) {
dom.footer.rightBlocker.remove();
}
if (dom.footer.leftBlocker) {
dom.footer.leftBlocker.remove();
}
if (this.c.header) {
this._modeChange('in-place', 'header', true);
}
if ( this.c.footer && this.dom.tfoot.length ) {
if (this.c.footer && dom.tfoot.length) {
this._modeChange('in-place', 'footer', true);
}
},
@@ -156,10 +190,11 @@ $.extend( FixedHeader.prototype, {
*
* @param {boolean} enable `true` to enable, `false` to disable
*/
enable: function ( enable, update )
{
enable: function (enable, update, type) {
this.s.enable = enable;
this.s.enableType = type;
if (update || update === undefined) {
this._positions();
this._scroll(true);
@@ -169,8 +204,7 @@ $.extend( FixedHeader.prototype, {
/**
* Get enabled status
*/
enabled: function ()
{
enabled: function () {
return this.s.enable;
},
@@ -179,8 +213,7 @@ $.extend( FixedHeader.prototype, {
*
* @param {int} new value for headerOffset
*/
headerOffset: function ( offset )
{
headerOffset: function (offset) {
if (offset !== undefined) {
this.c.headerOffset = offset;
this.update();
@@ -194,8 +227,7 @@ $.extend( FixedHeader.prototype, {
*
* @param {int} new value for footerOffset
*/
footerOffset: function ( offset )
{
footerOffset: function (offset) {
if (offset !== undefined) {
this.c.footerOffset = offset;
this.update();
@@ -204,25 +236,35 @@ $.extend( FixedHeader.prototype, {
return this.c.footerOffset;
},
/**
* Recalculate the position of the fixed elements and force them into place
*/
update: function ()
{
update: function (force) {
var table = this.s.dt.table().node();
// Update should only do something if enabled by the dev.
if (!this.s.enable && !this.s.autoDisable) {
return;
}
if ($(table).is(':visible')) {
this.s.autoDisable = false;
this.enable(true, false);
}
else {
this.s.autoDisable = true;
this.enable(false, false);
}
this._positions();
this._scroll( true );
},
// Don't update if header is not in the document atm (due to
// async events)
if ($(table).children('thead').length === 0) {
return;
}
this._positions();
this._scroll(force !== undefined ? force : true);
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
@@ -234,8 +276,7 @@ $.extend( FixedHeader.prototype, {
*
* @private
*/
_constructor: function ()
{
_constructor: function () {
var that = this;
var dt = this.s.dt;
@@ -243,10 +284,13 @@ $.extend( FixedHeader.prototype, {
.on('scroll' + this.s.namespace, function () {
that._scroll();
})
.on( 'resize'+this.s.namespace, DataTable.util.throttle( function () {
.on(
'resize' + this.s.namespace,
DataTable.util.throttle(function () {
that.s.position.windowHeight = $(window).height();
that.update();
}, 50 ) );
}, 50)
);
var autoHeader = $('.fh-fixedHeader');
if (!this.c.headerOffset && autoHeader.length) {
@@ -258,8 +302,14 @@ $.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 responsive-display.dt.dtfc', function () {
dt.on(
'column-reorder.dt.dtfc column-visibility.dt.dtfc column-sizing.dt.dtfc responsive-display.dt.dtfc',
function (e, ctx) {
that.update();
}
).on('draw.dt.dtfc', function (e, ctx) {
// For updates from our own table, don't reclone, but for all others, do
that.update(ctx === dt.settings()[0] ? false : true);
});
dt.on('destroy.dtfc', function () {
@@ -270,7 +320,6 @@ $.extend( FixedHeader.prototype, {
this._scroll();
},
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods
*/
@@ -285,13 +334,17 @@ $.extend( FixedHeader.prototype, {
* decision (reuse existing if available)
* @private
*/
_clone: function ( item, force )
{
_clone: function (item, force) {
var that = this;
var dt = this.s.dt;
var itemDom = this.dom[item];
var itemElement = item === 'header' ?
this.dom.thead :
this.dom.tfoot;
var itemElement = item === 'header' ? this.dom.thead : this.dom.tfoot;
// If footer and scrolling is enabled then we don't clone
// Instead the table's height is decreased accordingly - see `_scroll()`
if (item === 'footer' && this._scrollEnabled()) {
return;
}
if (!force && itemDom.floating) {
// existing floating element - reuse it
@@ -299,24 +352,65 @@ $.extend( FixedHeader.prototype, {
}
else {
if (itemDom.floating) {
if (itemDom.placeholder !== null) {
itemDom.placeholder.remove();
}
this._unsize(item);
itemDom.floating.children().detach();
itemDom.floating.remove();
}
var tableNode = $(dt.table().node());
var scrollBody = $(tableNode.parent());
var scrollEnabled = this._scrollEnabled();
itemDom.floating = $(dt.table().node().cloneNode(false))
.css( 'table-layout', 'fixed' )
.attr('aria-hidden', 'true')
.css({
'table-layout': 'fixed',
top: 0,
left: 0
})
.removeAttr('id')
.append( itemElement )
.append(itemElement);
itemDom.floatingParent
.css({
width: scrollBody.width(),
overflow: 'hidden',
height: 'fit-content',
position: 'fixed',
left: scrollEnabled ? tableNode.offset().left + scrollBody.scrollLeft() : 0
})
.css(
item === 'header'
? {
top: this.c.headerOffset,
bottom: ''
}
: {
top: '',
bottom: this.c.footerOffset
}
)
.addClass(item === 'footer' ? 'dtfh-floatingparentfoot' : 'dtfh-floatingparenthead')
.append(itemDom.floating)
.appendTo('body');
this._stickyPosition(itemDom.floating, '-');
var scrollLeftUpdate = function () {
var scrollLeft = scrollBody.scrollLeft();
that.s.scrollLeft = { footer: scrollLeft, header: scrollLeft };
itemDom.floatingParent.scrollLeft(that.s.scrollLeft.header);
};
scrollLeftUpdate();
scrollBody.off('scroll.dtfh').on('scroll.dtfh', scrollLeftUpdate);
// 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.placeholder.find('*[id]').removeAttr('id');
itemDom.host.prepend(itemDom.placeholder);
@@ -325,6 +419,39 @@ $.extend( FixedHeader.prototype, {
}
},
/**
* This method sets the sticky position of the header elements to match fixed columns
* @param {JQuery<HTMLElement>} el
* @param {string} sign
*/
_stickyPosition: function (el, sign) {
if (this._scrollEnabled()) {
var that = this;
var rtl = $(that.s.dt.table().node()).css('direction') === 'rtl';
el.find('th').each(function () {
// Find out if fixed header has previously set this column
if ($(this).css('position') === 'sticky') {
var right = $(this).css('right');
var left = $(this).css('left');
if (right !== 'auto' && !rtl) {
// New position either adds or dismisses the barWidth
var potential =
+right.replace(/px/g, '') +
(sign === '-' ? -1 : 1) * that.s.dt.settings()[0].oBrowser.barWidth;
$(this).css('right', potential > 0 ? potential : 0);
}
else if (left !== 'auto' && rtl) {
var potential =
+left.replace(/px/g, '') +
(sign === '-' ? -1 : 1) * that.s.dt.settings()[0].oBrowser.barWidth;
$(this).css('left', potential > 0 ? potential : 0);
}
}
});
}
},
/**
* Copy widths from the cells in one element to another. This is required
* for the footer as the footer in the main table takes its sizes from the
@@ -340,8 +467,13 @@ $.extend( FixedHeader.prototype, {
var get = function (name) {
return $(name, from)
.map(function () {
return $(this).css('width').replace(/[^\d\.]/g, '') * 1;
} ).toArray();
return (
$(this)
.css('width')
.replace(/[^\d\.]/g, '') * 1
);
})
.toArray();
};
var set = function (name, toWidths) {
@@ -391,14 +523,18 @@ $.extend( FixedHeader.prototype, {
* @param {int} scrollLeft Document scrollLeft
* @private
*/
_horizontal: function ( item, scrollLeft )
{
_horizontal: function (item, scrollLeft) {
var itemDom = this.dom[item];
var position = this.s.position;
var lastScrollLeft = this.s.scrollLeft;
if (itemDom.floating && lastScrollLeft[item] !== scrollLeft) {
itemDom.floating.css( 'left', position.left - scrollLeft );
// If scrolling is enabled we need to match the floating header to the body
if (this._scrollEnabled()) {
var newScrollLeft = $($(this.s.dt.table().node()).parent()).scrollLeft();
itemDom.floating.scrollLeft(newScrollLeft);
itemDom.floatingParent.scrollLeft(newScrollLeft);
}
lastScrollLeft[item] = scrollLeft;
}
@@ -419,29 +555,41 @@ $.extend( FixedHeader.prototype, {
* in that mode.
* @private
*/
_modeChange: function ( mode, item, forceChange )
{
_modeChange: function (mode, item, forceChange) {
var dt = this.s.dt;
var itemDom = this.dom[item];
var position = this.s.position;
// Just determine if scroll is enabled once
var scrollEnabled = this._scrollEnabled();
// If footer and scrolling is enabled then we don't clone
// Instead the table's height is decreased accordingly - see `_scroll()`
if (item === 'footer' && scrollEnabled) {
return;
}
// 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;';
});
// If not scrolling also have to update the floatingParent
if (!scrollEnabled) {
itemDom.floatingParent.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();
}
var focus = $.contains(tablePart[0], document.activeElement)
? document.activeElement
: null;
var scrollBody = $($(this.s.dt.table().node()).parent());
if (mode === 'in-place') {
// Insert the header back into the table's real header
@@ -462,17 +610,56 @@ $.extend( FixedHeader.prototype, {
if (itemDom.floating) {
itemDom.floating.remove();
itemDom.floating = null;
this._stickyPosition(itemDom.host, '+');
}
if (itemDom.floatingParent) {
itemDom.floatingParent.remove();
}
$($(itemDom.host.parent()).parent()).scrollLeft(scrollBody.scrollLeft());
}
else if (mode === 'in') {
// Remove the header from the read header and insert into a fixed
// positioned floating table clone
this._clone(item, forceChange);
itemDom.floating
.addClass( 'fixedHeader-floating' )
.css( item === 'header' ? 'top' : 'bottom', this.c[item+'Offset'] )
.css( 'left', position.left+'px' );
// Get useful position values
var scrollOffset = scrollBody.offset();
var windowTop = $(document).scrollTop();
var windowHeight = $(window).height();
var windowBottom = windowTop + windowHeight;
var bodyTop = scrollEnabled ? scrollOffset.top : position.tbodyTop;
var bodyBottom = scrollEnabled
? scrollOffset.top + scrollBody.outerHeight()
: position.tfootTop;
// Calculate the amount that the footer or header needs to be shuffled
var shuffle =
item === 'footer'
? // footer and top of body isn't on screen
bodyTop > windowBottom
? // Yes - push the footer below
position.tfootHeight
: // No - bottom set to the gap between the top of the body and the bottom of the window
bodyTop + position.tfootHeight - windowBottom
: // Otherwise must be a header so get the difference from the bottom of the
// desired floating header and the bottom of the table body
windowTop + this.c.headerOffset + position.theadHeight - bodyBottom;
// Set the top or bottom based off of the offset and the shuffle value
var prop = item === 'header' ? 'top' : 'bottom';
var val = this.c[item + 'Offset'] - (shuffle > 0 ? shuffle : 0);
itemDom.floating.addClass('fixedHeader-floating');
itemDom.floatingParent
.css(prop, val)
.css({
left: position.left,
height: item === 'header' ? position.theadHeight : position.tfootHeight,
'z-index': 2
})
.append(itemDom.floating);
importantWidth(position.width);
@@ -480,25 +667,31 @@ $.extend( FixedHeader.prototype, {
itemDom.floating.css('top', '');
}
}
else if ( mode === 'below' ) { // only used for the header
else if (mode === 'below') {
// only used for the header
// Fix the position of the floating header at base of the table body
this._clone(item, forceChange);
itemDom.floating
.addClass( 'fixedHeader-locked' )
.css( 'top', position.tfootTop - position.theadHeight )
.css( 'left', position.left+'px' );
itemDom.floating.addClass('fixedHeader-locked');
itemDom.floatingParent.css({
position: 'absolute',
top: position.tfootTop - position.theadHeight,
left: position.left + 'px'
});
importantWidth(position.width);
}
else if ( mode === 'above' ) { // only used for the footer
else if (mode === 'above') {
// only used for the footer
// Fix the position of the floating footer at top of the table body
this._clone(item, forceChange);
itemDom.floating
.addClass( 'fixedHeader-locked' )
.css( 'top', position.tbodyTop )
.css( 'left', position.left+'px' );
itemDom.floating.addClass('fixedHeader-locked');
itemDom.floatingParent.css({
position: 'absolute',
top: position.tbodyTop,
left: position.left + 'px'
});
importantWidth(position.width);
}
@@ -521,33 +714,35 @@ $.extend( FixedHeader.prototype, {
*
* @private
*/
_positions: function ()
{
_positions: function () {
var dt = this.s.dt;
var table = dt.table();
var position = this.s.position;
var dom = this.dom;
var tableNode = $(table.node());
var scrollEnabled = this._scrollEnabled();
// Need to use the header and footer that are in the main table,
// regardless of if they are clones, since they hold the positions we
// want to measure from
var thead = tableNode.children('thead');
var tfoot = tableNode.children('tfoot');
var thead = $(dt.table().header());
var tfoot = $(dt.table().footer());
var tbody = dom.tbody;
var scrollBody = tableNode.parent();
position.visible = tableNode.is(':visible');
position.width = tableNode.outerWidth();
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;
position.tbodyTop = scrollEnabled ? scrollBody.offset().top : tbody.offset().top;
position.tbodyHeight = scrollEnabled ? scrollBody.outerHeight() : tbody.outerHeight();
position.theadHeight = thead.outerHeight();
position.theadBottom = position.theadTop + position.theadHeight;
if (tfoot.length) {
position.tfootTop = tfoot.offset().top;
position.tfootTop = position.tbodyTop + position.tbodyHeight; //tfoot.offset().top;
position.tfootBottom = position.tfootTop + tfoot.outerHeight();
position.tfootHeight = position.tfootBottom - position.tfootTop;
position.tfootHeight = tfoot.outerHeight();
}
else {
position.tfootTop = position.tbodyTop + tbody.outerHeight();
@@ -556,7 +751,6 @@ $.extend( FixedHeader.prototype, {
}
},
/**
* Mode calculation - determine what mode the fixed items should be placed
* into.
@@ -565,23 +759,74 @@ $.extend( FixedHeader.prototype, {
* in that mode.
* @private
*/
_scroll: function ( forceChange )
{
var windowTop = $(document).scrollTop();
_scroll: function (forceChange) {
if (this.s.dt.settings()[0].bDestroying) {
return;
}
// ScrollBody details
var scrollEnabled = this._scrollEnabled();
var scrollBody = $(this.s.dt.table().node()).parent();
var scrollOffset = scrollBody.offset();
var scrollHeight = scrollBody.outerHeight();
// Window details
var windowLeft = $(document).scrollLeft();
var windowTop = $(document).scrollTop();
var windowHeight = $(window).height();
var windowBottom = windowHeight + windowTop;
var position = this.s.position;
var headerMode, footerMode;
// Body Details
var bodyTop = scrollEnabled ? scrollOffset.top : position.tbodyTop;
var bodyLeft = scrollEnabled ? scrollOffset.left : position.left;
var bodyBottom = scrollEnabled ? scrollOffset.top + scrollHeight : position.tfootTop;
var bodyWidth = scrollEnabled ? scrollBody.outerWidth() : position.tbodyWidth;
var windowBottom = windowTop + windowHeight;
if (this.c.header) {
if (!this.s.enable) {
headerMode = 'in-place';
}
else if ( ! position.visible || windowTop <= position.theadTop - this.c.headerOffset ) {
// The header is in it's normal place if the body top is lower than
// the scroll of the window plus the headerOffset and the height of the header
else if (
!position.visible ||
windowTop + this.c.headerOffset + position.theadHeight <= bodyTop
) {
headerMode = 'in-place';
}
else if ( windowTop <= position.tfootTop - position.theadHeight - this.c.headerOffset ) {
// The header should be floated if
else if (
// The scrolling plus the header offset plus the height of the header is lower than the top of the body
windowTop + this.c.headerOffset + position.theadHeight > bodyTop &&
// And the scrolling at the top plus the header offset is above the bottom of the body
windowTop + this.c.headerOffset + position.theadHeight < bodyBottom
) {
headerMode = 'in';
var scrollBody = $($(this.s.dt.table().node()).parent());
// Further to the above, If the scrolling plus the header offset plus the header height is lower
// than the bottom of the table a shuffle is required so have to force the calculation
if (
windowTop + this.c.headerOffset + position.theadHeight > bodyBottom ||
this.dom.header.floatingParent === undefined
) {
forceChange = true;
}
else {
this.dom.header.floatingParent
.css({
top: this.c.headerOffset,
position: 'fixed'
})
.append(this.dom.header.floating);
}
}
// Anything else and the view is below the table
else {
headerMode = 'below';
}
@@ -593,15 +838,31 @@ $.extend( FixedHeader.prototype, {
this._horizontal('header', windowLeft);
}
var header = {
offset: { top: 0, left: 0 },
height: 0
};
var footer = {
offset: { top: 0, left: 0 },
height: 0
};
if (this.c.footer && this.dom.tfoot.length) {
if (!this.s.enable) {
footerMode = 'in-place';
}
else if ( ! position.visible || windowTop + position.windowHeight >= position.tfootBottom + this.c.footerOffset ) {
else if (
!position.visible ||
position.tfootBottom + this.c.footerOffset <= windowBottom
) {
footerMode = 'in-place';
}
else if ( position.windowHeight + windowTop > position.tbodyTop + position.tfootHeight + this.c.footerOffset ) {
else if (
bodyBottom + position.tfootHeight + this.c.footerOffset > windowBottom &&
bodyTop + this.c.footerOffset < windowBottom
) {
footerMode = 'in';
forceChange = true;
}
else {
footerMode = 'above';
@@ -612,17 +873,134 @@ $.extend( FixedHeader.prototype, {
}
this._horizontal('footer', windowLeft);
var getOffsetHeight = function (el) {
return {
offset: el.offset(),
height: el.outerHeight()
};
};
header = this.dom.header.floating
? getOffsetHeight(this.dom.header.floating)
: getOffsetHeight(this.dom.thead);
footer = this.dom.footer.floating
? getOffsetHeight(this.dom.footer.floating)
: getOffsetHeight(this.dom.tfoot);
// If scrolling is enabled and the footer is off the screen
if (scrollEnabled && footer.offset.top > windowTop) {
// && footer.offset.top >= windowBottom) {
// Calculate the gap between the top of the scrollBody and the top of the window
var overlap = windowTop - scrollOffset.top;
// The new height is the bottom of the window
var newHeight =
windowBottom +
// If the gap between the top of the scrollbody and the window is more than
// the height of the header then the top of the table is still visible so add that gap
// Doing this has effectively calculated the height from the top of the table to the bottom of the current page
(overlap > -header.height ? overlap : 0) -
// Take from that
// The top of the header plus
(header.offset.top +
// The header height if the standard header is present
(overlap < -header.height ? header.height : 0) +
// And the height of the footer
footer.height);
// Don't want a negative height
if (newHeight < 0) {
newHeight = 0;
}
// At the end of the above calculation the space between the header (top of the page if floating)
// and the point just above the footer should be the new value for the height of the table.
scrollBody.outerHeight(newHeight);
// Need some rounding here as sometimes very small decimal places are encountered
// If the actual height is bigger or equal to the height we just applied then the footer is "Floating"
if (Math.round(scrollBody.outerHeight()) >= Math.round(newHeight)) {
$(this.dom.tfoot.parent()).addClass('fixedHeader-floating');
}
// Otherwise max-width has kicked in so it is not floating
else {
$(this.dom.tfoot.parent()).removeClass('fixedHeader-floating');
}
}
}
if (this.dom.header.floating) {
this.dom.header.floatingParent.css('left', bodyLeft - windowLeft);
}
if (this.dom.footer.floating) {
this.dom.footer.floatingParent.css('left', bodyLeft - windowLeft);
}
// If fixed columns is being used on this table then the blockers need to be copied across
// Cloning these is cleaner than creating as our own as it will keep consistency with fixedColumns automatically
// ASSUMING that the class remains the same
if (this.s.dt.settings()[0]._fixedColumns !== undefined) {
var adjustBlocker = function (side, end, el) {
if (el === undefined) {
var blocker = $('div.dtfc-' + side + '-' + end + '-blocker');
el = blocker.length === 0 ? null : blocker.clone().css('z-index', 1);
}
if (el !== null) {
if (headerMode === 'in' || headerMode === 'below') {
el.appendTo('body').css({
top: end === 'top' ? header.offset.top : footer.offset.top,
left: side === 'right' ? bodyLeft + bodyWidth - el.width() : bodyLeft
});
}
else {
el.detach();
}
}
return el;
};
// Adjust all blockers
this.dom.header.rightBlocker = adjustBlocker(
'right',
'top',
this.dom.header.rightBlocker
);
this.dom.header.leftBlocker = adjustBlocker('left', 'top', this.dom.header.leftBlocker);
this.dom.footer.rightBlocker = adjustBlocker(
'right',
'bottom',
this.dom.footer.rightBlocker
);
this.dom.footer.leftBlocker = adjustBlocker(
'left',
'bottom',
this.dom.footer.leftBlocker
);
}
},
/**
* Function to check if scrolling is enabled on the table or not
* @returns Boolean value indicating if scrolling on the table is enabled or not
*/
_scrollEnabled: function () {
var oScroll = this.s.dt.settings()[0].oScroll;
if (oScroll.sY !== '' || oScroll.sX !== '') {
return true;
}
return false;
}
});
/**
* Version
* @type {String}
* @static
*/
FixedHeader.version = "3.1.8";
FixedHeader.version = '3.4.0';
/**
* Defaults
@@ -636,7 +1014,6 @@ FixedHeader.defaults = {
footerOffset: 0
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables interfaces
*/
@@ -645,7 +1022,6 @@ FixedHeader.defaults = {
$.fn.dataTable.FixedHeader = FixedHeader;
$.fn.DataTable.FixedHeader = FixedHeader;
// DataTables creation - check if the FixedHeader option has been defined on the
// table and if so, initialise
$(document).on('init.dt.dtfh', function (e, settings, json) {
@@ -682,7 +1058,7 @@ DataTable.Api.register( 'fixedHeader.enable()', function ( flag ) {
return this.iterator('table', function (ctx) {
var fh = ctx._fixedHeader;
flag = ( flag !== undefined ? flag : true );
flag = flag !== undefined ? flag : true;
if (fh && flag !== fh.enabled()) {
fh.enable(flag);
}
@@ -716,9 +1092,9 @@ $.each( ['header', 'footer'], function ( i, el ) {
var ctx = this.context;
if (offset === undefined) {
return ctx.length && ctx[0]._fixedHeader ?
ctx[0]._fixedHeader[el +'Offset']() :
undefined;
return ctx.length && ctx[0]._fixedHeader
? ctx[0]._fixedHeader[el + 'Offset']()
: undefined;
}
return this.iterator('table', function (ctx) {
@@ -732,5 +1108,5 @@ $.each( ['header', 'footer'], function ( i, el ) {
});
return FixedHeader;
return DataTable;
}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +1,48 @@
{
"name": "datatables.net-fixedheader",
"version": "3.1.8",
"description": "FixedHeader for DataTables",
"files": [
"js/**/*.js"
],
"main": "js/dataTables.fixedHeader.js",
"type": "types.d.ts",
"module": "js/dataTables.fixedHeader.mjs",
"types": "./types/types.d.ts",
"version": "3.4.1",
"files": [
"js/**/*.js",
"js/**/*.mjs",
"types/**/*.d.ts"
],
"keywords": [
"fixed headers",
"sticky",
"DataTables",
"FixedHeader",
"Fixed Headers",
"Sticky",
"Datatables",
"jQuery",
"table",
"DataTables"
"filter",
"sort"
],
"dependencies": {
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
},
"moduleType": [
"globals",
"amd",
"node"
],
"ignore": [
"composer.json",
"datatables.json",
"package.json"
],
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"author": {
"name": "SpryMedia Ltd",
"url": "http://datatables.net"
},
"dependencies": {
"jquery": ">=1.7",
"datatables.net": "^1.10.15"
},
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/DataTables/Dist-DataTables-FixedHeader.git"
},
"devDependencies": {
"@types/jquery": "^3.5.1"
}
}

View File

@@ -0,0 +1,148 @@
// Type definitions for DataTables FixedHeader
//
// Project: https://datatables.net/extensions/fixedheader/, https://datatables.net
// Definitions by:
// SpryMedia
// Jared Szechy <https://github.com/szechyjs>
// Kiarash Ghiaseddin <https://github.com/Silver-Connection>
/// <reference types="jquery" />
import DataTables, {Api} from 'datatables.net';
export default DataTables;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables' types integration
*/
declare module 'datatables.net' {
interface Config {
/*
* FixedHeader extension options
*/
fixedHeader?: boolean | ConfigFixedHeader;
}
interface Api<T> {
/**
* FixedHeader methods container
*
* @returns Api for chaining with the additional FixedHeader methods
*/
fixedHeader: ApiFixedHeaderMethods<T>;
}
interface ApiStatic {
/**
* FixedHeader class
*/
FixedHeader: {
/**
* Create a new FixedHeader instance for the target DataTable
*/
new (dt: Api<any>, settings: boolean | ConfigFixedHeader);
/**
* FixedHeader version
*/
version: string;
/**
* Default configuration values
*/
defaults: ConfigFixedHeader;
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Options
*/
interface ConfigFixedHeader {
/*
* Enable / disable fixed footer
*/
footer?: boolean;
/*
* Offset the table's fixed footer
*/
footerOffset?: number;
/*
* Enable / disable fixed header
*/
header?: boolean;
/*
* Offset the table's fixed header
*/
headerOffset?: number;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* API
*/
interface ApiFixedHeaderMethods<T> extends Api<T> {
/**
* Recalculate the position of the DataTable on the page and adjust the fixed element as appropriate.
*
* @returns The DataTables API for chaining
*/
adjust(): Api<T>;
/**
* Disable the fixed elements
*
* @returns The DataTables API for chaining
*/
disable(): Api<T>;
/**
* Enable / disable the fixed elements
*
* @param enable Flag to indicate if the FixedHeader elements should be enabled or disabled, default true.
* @returns The DataTables API for chaining
*/
enable(enable?: boolean): Api<T>;
/**
* Simply gets the status of FixedHeader for this table.
*
* @returns true if FixedHeader is enabled on this table. false otherwise.
*/
enabled(): boolean;
/**
* Get the fixed footer's offset.
*
* @returns The current footer offset
*/
footerOffset(): number;
/**
* Set the fixed footer's offset
*
* @param offset The offset to be set
* @returns DataTables Api for chaining
*/
footerOffset(offset: number): Api<T>;
/**
* Get the fixed header's offset.
*
* @returns The current header offset
*/
headerOffset(): number;
/**
* Set the fixed header's offset
*
* @param offset The offset to be set
* @returns The DataTables API for chaining
*/
headerOffset(offset: number): Api<T>;
}

View File

@@ -1,3 +1,5 @@
The MIT License (MIT)
Copyright SpryMedia Limited and other contributors
http://datatables.net

View File

@@ -17,11 +17,17 @@ For inclusion of this library using a standard `<script>` tag, rather than using
npm install datatables.net-responsive
```
ES3 Syntax
```
var $ = require( 'jquery' );
require( 'datatables.net-responsive' )( window, $ );
```
ES6 Syntax
```
import 'datatables.net-responsive'
```
### bower
```
@@ -32,8 +38,7 @@ bower install --save datatables.net-responsive
## Documentation
Full documentation of the DataTables options, API and plug-in interface are available on the DOCS_LINK. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.
Full documentation and examples for Responsive can be found [on the website](https://datatables.net/extensions/responsive).
## Bug / Support

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,44 @@
{
"name": "datatables.net-responsive",
"version": "2.2.7",
"description": "Responsive for DataTables",
"files": [
"js/**/*.js"
],
"main": "js/dataTables.responsive.js",
"module": "js/dataTables.responsive.mjs",
"types": "./types/types.d.ts",
"version": "2.5.1",
"files": [
"js/**/*.js",
"js/**/*.mjs",
"types/**/*.d.ts"
],
"keywords": [
"responsive",
"DataTables",
"Responsive",
"Datatables",
"jQuery",
"table",
"DataTables"
"filter",
"sort"
],
"dependencies": {
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
},
"moduleType": [
"globals",
"amd",
"node"
],
"ignore": [
"composer.json",
"datatables.json",
"package.json"
],
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"author": {
"name": "SpryMedia Ltd",
"url": "http://datatables.net"
},
"dependencies": {
"jquery": ">=1.7",
"datatables.net": "^1.10.15"
},
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/DataTables/Dist-DataTables-Responsive.git"

229
node_modules/datatables.net-responsive/types/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,229 @@
// Type definitions for DataTables Responsive
//
// Project: https://datatables.net/extensions/responsive/, https://datatables.net
// Definitions by:
// SpryMedia
/// <reference types="jquery" />
import DataTables, {Api} from 'datatables.net';
export default DataTables;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables' types integration
*/
declare module 'datatables.net' {
interface Config {
/**
* Responsive extension options
*/
responsive?: boolean | ConfigResponsive;
}
interface ConfigColumns {
/**
* Set column's visibility priority
*/
responsivePriority?: number;
}
interface Api<T> {
/**
* Responsive methods container
*
* @returns Api for chaining with the additional Responsive methods
*/
responsive: ApiResponsiveMethods<T>;
}
interface ApiColumnMethods {
/**
* Get the responsive visibility state of a column in the table
*/
responsiveHidden(): boolean;
}
interface ApiColumnsMethods {
/**
* Get the responsive visibility state of columns in the table
*/
responsiveHidden(): Api<boolean>;
}
interface ApiStatic {
/**
* Responsive class
*/
Responsive: {
/**
* Create a new Responsive instance for the target DataTable
*/
new (dt: Api<any>, settings: boolean | ConfigResponsive);
/**
* Default configuration values
*/
defaults: ConfigResponsive;
/**
* List of default breakpoints
*/
breakpoints: ResponsiveBreakpoint[];
display: {
childRow: ResponsiveDisplay,
childRowImmediate: ResponsiveDisplay,
modal: ResponsiveDisplay,
};
/**
* Namespace to hold Responsive renderers
*/
renderer: {
listHiddenNodes(): ResponsiveRenderer,
listHidden(): ResponsiveRenderer,
tableAll(options?: {tableClass?: string}): ResponsiveRenderer,
};
/**
* Responsive version
*/
version: string;
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Options
*/
interface ConfigResponsive {
/**
* Set the breakpoints for a responsive instance
*/
breakpoints?: Array<Object>;
/**
* Enable and configure the child rows shown by Responsive for collapsed tables.
*/
details?: boolean | ConfigResponsiveDetails;
/**
* The data type to request when obtaining data from the DataTable for a specific cell. See the columns.render and cell().render() documentation for full details.
*/
orthogonal?: string;
}
interface ApiResponsiveMethods<T> extends Api<T> {
/**
* Determine if Responsive has hidden any columns in the table
*
* @returns true if columns have been hidden, false if not
*/
hasHidden(): boolean
/**
* DEPRECATED
* Calculate the cell index from a li details element
*
* @param li The li node (or a jQuery collection containing the node) to get the cell index for.
* @returns Cell object that contains the properties row and column. This object can be used as a DataTables cell-selector.
*/
index(li): object;
/**
* Recalculate the column breakpoints based on the class information of the column header cells
*
* @returns DataTables API instance
*/
rebuild(): Api<T>;
/**
* Recalculate the widths used by responsive after a change in the display.
*
* @returns DataTables Api instance
*/
recalc(): Api<T>;
}
interface ConfigResponsiveDetails {
/**
* Define how the hidden information should be displayed to the end user.
*
* @param row DataTables API instance for the table in question which is pre-populated with the row that is being acted upon - i.e. the result from row().
* @param update This parameter is used to inform the function what has triggered the function call:
* @param render The data to be shown - this is given as a function so it will be executed only when required (i.e. there is no point in gather data to display if the display function is simply going to hide it). The string returned by this function is that given by the responsive.details.renderer function. It accepts no input parameters.
* @returns boolean true if the display function has shown the hidden data, false
*/
display?(row, update, render): boolean;
/**
* Define the renderer used to display the child rows.
*
* @param api DataTables API instance for the table in question
* @param rowIdx Row index for the row that the renderer is being asked to render. Use the row() and / or cells() methods to get information from the API about the row so the information can be rendered.
* @param columns Since 2.0.0: An array of objects containing information about each column in the DataTable. The array length is exactly equal to the number of columns in the DataTable, with each column represented by a DataTable in index order. Additionally, the structure of each object in the array is:
* @returns boolean | string `false` - Do not display a child row. Or a string - The information to be shown in the details display, including any required HTML.
*/
renderer?(api, rowIdx, columns): Node | false;
/**
* As a number it is a column index to the show / hide control should be attached. This can be >=0 to count columns from the left, or <0 to count from the right.
*
* As a string, this option is used as a jQuery selector to determine what element(s) will activate the show / hide control for the details child rows. This provides the ability to use any element in a table - for example you can use the whole row, or a single img element in the row.
*/
target?: number | string;
/**
* The child row display type to use. This can be one of: `inline`, `column` or `none`
*/
type?: string;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Support
*/
interface ResponsiveBreakpoint {
/**
* Breakpoint name
*/
name: string;
/**
* Breakpoint width
*/
width: number;
}
interface ResponsiveRenderer {
/**
* Rendering functions for Responsive
*/
(api: Api<any>, rowIdx: number, columns: ResponsiveColumn[]): Node | false;
}
interface ResponsiveDisplay {
/**
* Display function for Responsive.
*
* @param row DataTables API row() for the row in question
* @param update Indicates if this is a redraw (true) or a fresh draw (false)
* @param render Rendering function to be executed to get the data to show for the row
*/
(row: Api<any>, update: boolean, render: () => Node): boolean;
}
interface ResponsiveColumn {
className: string;
columnIndex: number;
data: any;
hidden: boolean;
rowIndex: number;
title: string;
}

View File

@@ -1,3 +1,5 @@
The MIT License (MIT)
Copyright SpryMedia Limited and other contributors
http://datatables.net

View File

@@ -17,11 +17,17 @@ For inclusion of this library using a standard `<script>` tag, rather than using
npm install datatables.net-scroller
```
ES3 Syntax
```
var $ = require( 'jquery' );
require( 'datatables.net-scroller' )( window, $ );
```
ES6 Syntax
```
import 'datatables.net-scroller'
```
### bower
```
@@ -32,8 +38,7 @@ bower install --save datatables.net-scroller
## Documentation
Full documentation of the DataTables options, API and plug-in interface are available on the DOCS_LINK. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.
Full documentation and examples for Scroller can be found [on the website](https://datatables.net/extensions/scroller).
## Bug / Support

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,45 @@
{
"name": "datatables.net-scroller",
"version": "1.5.1",
"description": "Scroller for DataTables",
"files": [
"js/**/*.js"
],
"main": "js/dataTables.scroller.js",
"module": "js/dataTables.scroller.mjs",
"types": "./types/types.d.ts",
"version": "2.4.1",
"files": [
"js/**/*.js",
"js/**/*.mjs",
"types/**/*.d.ts"
],
"keywords": [
"virtual scrolling",
"DataTables",
"Scroller",
"Virtual Scrolling",
"Datatables",
"jQuery",
"table",
"DataTables"
"filter",
"sort"
],
"dependencies": {
"datatables.net": "1.11 - 2",
"jquery": ">=1.7"
},
"moduleType": [
"globals",
"amd",
"node"
],
"ignore": [
"composer.json",
"datatables.json",
"package.json"
],
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"author": {
"name": "SpryMedia Ltd",
"url": "http://datatables.net"
},
"dependencies": {
"jquery": ">=1.7",
"datatables.net": "^1.10.15"
},
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/DataTables/Dist-DataTables-Scroller.git"

143
node_modules/datatables.net-scroller/types/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,143 @@
// Type definitions for DataTables Scroller
//
// Project: https://datatables.net/extensions/scroller/, https://datatables.net
// Definitions by:
// SpryMedia
// Konstantin Rohde <https://github.com/RohdeK>
import DataTables, {Api} from 'datatables.net';
export default DataTables;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables' types integration
*/
declare module 'datatables.net' {
interface Config {
/**
* Scroller extension options
*/
scroller?: boolean | ConfigScroller;
}
interface Api<T> {
/**
* Scroller methods container
*
* @returns Api for chaining with the additional Scroller methods
*/
scroller: ApiScrollerMethods<T>;
}
interface ApiRowMethods<T> {
/**
* Scroll to a row
*/
scrollTo(animate?: boolean): Api<T>;
}
interface DataTablesStatic {
/**
* Scroller class
*/
Scroller: {
/**
* Create a new Scroller instance for the target DataTable
*/
new (dt: Api<any>, settings: boolean | ConfigScroller): DataTablesStatic['Scroller'];
/**
* Scroller version
*/
version: string;
/**
* Default configuration values
*/
defaults: ConfigScroller;
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Options
*/
interface ConfigScroller {
/**
* Scroller uses the boundary scaling factor to decide when to redraw the table - which it
* typically does before you reach the end of the currently loaded data set (in order to
* allow the data to look continuous to a user scrolling through the data).
*/
boundaryScale?: number;
/**
* The display buffer is what Scroller uses to calculate how many rows it should pre-fetch
* for scrolling.
*/
displayBuffer?: number;
/**
* Show (or not) the loading element in the background of the table. Note that you should
* include the dataTables.scroller.css file for this to be displayed correctly.
*/
loadingIndicator?: boolean;
/**
* Scroller will attempt to automatically calculate the height of rows for it's internal
* calculations. However the height that is used can be overridden using this parameter.
*/
rowHeight?: number | string;
/**
* When using server-side processing, Scroller will wait a small amount of time to allow
* the scrolling to finish before requesting more data from the server.
*/
serverWait?: number;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* API
*/
interface ApiScrollerMethods<T> {
/**
* Calculate and store information about how many rows are to be displayed
* in the scrolling viewport, based on current dimensions in the browser's
* rendering.
*
* @param redraw Flag to indicate if the table should immediately redraw or not. true will redraw the table, false will not.
* @returns DataTables Api instance for chaining
*/
measure(redraw?: boolean): Api<T>;
/**
* Get information about current displayed record range.
*
* @returnsAn object with the parameters start and end, defining the start and end, 0 based, display indexes of the rows that are visible in the table's scrolling viewport.
*/
page(): PageInfo;
/**
* Move the display to show the row at the index given.
*
* @param index Display index to jump to.
* @param animate Animate the scroll (true) or not (false).
*/
toPosition(index: number, animate?: boolean): Api<T>;
}
interface PageInfo {
/**
* The 0-indexed record at the top of the viewport
*/
start: number;
/**
* The 0-indexed record at the bottom of the viewport
*/
end: number;
}

View File

@@ -1,3 +1,5 @@
The MIT License (MIT)
Copyright SpryMedia Limited and other contributors
http://datatables.net

View File

@@ -17,11 +17,17 @@ For inclusion of this library using a standard `<script>` tag, rather than using
npm install datatables.net-select
```
ES3 Syntax
```
var $ = require( 'jquery' );
require( 'datatables.net-select' )( window, $ );
```
ES6 Syntax
```
import 'datatables.net-select'
```
### bower
```
@@ -32,8 +38,7 @@ bower install --save datatables.net-select
## Documentation
Full documentation of the DataTables options, API and plug-in interface are available on the DOCS_LINK. The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further.
Full documentation and examples for Select can be found [on the website](https://datatables.net/extensions/select).
## Bug / Support

View File

@@ -1,26 +1,7 @@
/*! Select for DataTables 1.3.3
* 2015-2021 SpryMedia Ltd - datatables.net/license/mit
/*! Select for DataTables 1.7.0-dev
* © SpryMedia Ltd - datatables.net/license/mit
*/
/**
* @summary Select for DataTables
* @description A collection of API methods, events and buttons for DataTables
* that provides selection options of the items in a DataTable
* @version 1.3.3
* @file dataTables.select.js
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact datatables.net/forums
* @copyright Copyright 2015-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/extensions/select
*/
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
@@ -30,18 +11,34 @@
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ || ! $.fn.dataTable ) {
$ = require('datatables.net')(root, $).$;
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
@@ -51,18 +48,70 @@
var DataTable = $.fn.dataTable;
// Version information for debugger
DataTable.select = {};
DataTable.select.version = '1.3.3';
DataTable.select.version = '1.7.0-dev';
DataTable.select.init = function (dt) {
var ctx = dt.settings()[0];
if (ctx._select) {
return;
}
var savedSelected = dt.state.loaded();
var selectAndSave = function (e, settings, data) {
if (data === null || data.select === undefined) {
return;
}
// Clear any currently selected rows, before restoring state
// None will be selected on first initialisation
if (dt.rows({ selected: true }).any()) {
dt.rows().deselect();
}
if (data.select.rows !== undefined) {
dt.rows(data.select.rows).select();
}
if (dt.columns({ selected: true }).any()) {
dt.columns().deselect();
}
if (data.select.columns !== undefined) {
dt.columns(data.select.columns).select();
}
if (dt.cells({ selected: true }).any()) {
dt.cells().deselect();
}
if (data.select.cells !== undefined) {
for (var i = 0; i < data.select.cells.length; i++) {
dt.cell(data.select.cells[i].row, data.select.cells[i].column).select();
}
}
dt.state.save();
};
dt.on('stateSaveParams', function (e, settings, data) {
data.select = {};
data.select.rows = dt.rows({ selected: true }).ids(true).toArray();
data.select.columns = dt.columns({ selected: true })[0];
data.select.cells = dt.cells({ selected: true })[0].map(function (coords) {
return { row: dt.row(coords.row).id(true), column: coords.column };
});
})
.on('stateLoadParams', selectAndSave)
.one('init', function () {
selectAndSave(undefined, undefined, savedSelected);
});
var init = ctx.oInit.select;
var defaults = DataTable.defaults.select;
var opts = init === undefined ?
defaults :
init;
var opts = init === undefined ? defaults : init;
// Set defaults
var items = 'row';
@@ -128,13 +177,16 @@ DataTable.select.init = function ( dt ) {
dt.select.info(info);
ctx._select.className = className;
// Sort table based on selected rows. Requires Select Datatables extension
$.fn.dataTable.ext.order['select-checkbox'] = function (settings, col) {
return this.api().column( col, {order: 'index'} ).nodes().map( function ( td ) {
return this.api()
.column(col, { order: 'index' })
.nodes()
.map(function (td) {
if (settings._select.items === 'row') {
return $(td).parent().hasClass(settings._select.className);
} else if ( settings._select.items === 'cell' ) {
}
else if (settings._select.items === 'cell') {
return $(td).hasClass(settings._select.className);
}
return false;
@@ -212,7 +264,6 @@ handler that will select the items using the API methods.
*/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Local functions
*/
@@ -231,8 +282,7 @@ handler that will select the items using the API methods.
* @param {object} last Cell index to select from
* @private
*/
function cellRange( dt, idx, last )
{
function cellRange(dt, idx, last) {
var indexes;
var columnIndexes;
var rowIndexes;
@@ -244,12 +294,16 @@ function cellRange( dt, idx, last )
}
var record = false;
return dt.columns( ':visible' ).indexes().filter( function (i) {
return dt
.columns(':visible')
.indexes()
.filter(function (i) {
if (i === start) {
record = true;
}
if ( i === end ) { // not else if, as start might === end
if (i === end) {
// not else if, as start might === end
record = false;
return true;
}
@@ -312,8 +366,7 @@ function cellRange( dt, idx, last )
* @param {DataTable.Api} dt DataTable to remove events from
* @private
*/
function disableMouseSelection( dt )
{
function disableMouseSelection(dt) {
var ctx = dt.settings()[0];
var selector = ctx._select.selector;
@@ -331,8 +384,7 @@ function disableMouseSelection( dt )
* @param {DataTable.Api} dt DataTable to remove events from
* @private
*/
function enableMouseSelection ( dt )
{
function enableMouseSelection(dt) {
var container = $(dt.table().container());
var ctx = dt.settings()[0];
var selector = ctx._select.selector;
@@ -370,7 +422,10 @@ function enableMouseSelection ( dt )
// If the element that contains the selection is not in the table, we can ignore it
// This can happen if the developer selects text from the click event
if ( ! selection.anchorNode || $(selection.anchorNode).closest('table')[0] === dt.table().node() ) {
if (
!selection.anchorNode ||
$(selection.anchorNode).closest('table')[0] === dt.table().node()
) {
if (selection !== matchSelection) {
return;
}
@@ -436,6 +491,13 @@ function enableMouseSelection ( dt )
return;
}
var event = $.Event('select-blur.dt');
eventTrigger(dt, event, [e.target, e]);
if (event.isDefaultPrevented()) {
return;
}
clear(ctx, true);
}
});
@@ -451,8 +513,7 @@ function enableMouseSelection ( dt )
* triggering
* @private
*/
function eventTrigger ( api, type, args, any )
{
function eventTrigger(api, type, args, any) {
if (any && !api.flatten().length) {
return;
}
@@ -473,8 +534,7 @@ function eventTrigger ( api, type, args, any )
* @param {DataTable.Api} api DataTable to update
* @private
*/
function info ( api )
{
function info(api) {
var ctx = api.settings()[0];
if (!ctx._select.info || !ctx.aanFeatures.i) {
@@ -490,11 +550,15 @@ function info ( api )
var cells = api.cells({ selected: true }).flatten().length;
var add = function (el, name, num) {
el.append( $('<span class="select-item"/>').append( api.i18n(
el.append(
$('<span class="select-item"/>').append(
api.i18n(
'select.' + name + 's',
{ _: '%d ' + name + 's selected', 0: '', 1: '1 ' + name + ' selected' },
num
) ) );
)
)
);
};
// Internal knowledge of DataTables to loop over all information elements
@@ -529,6 +593,7 @@ function info ( api )
*/
function init(ctx) {
var api = new DataTable.Api(ctx);
ctx._select_init = true;
// Row callback so that classes can be added to rows and cells if the item
// was selected before the element was created. This will happen with the
@@ -550,7 +615,10 @@ function init ( ctx ) {
// Cells and columns - if separated out, we would need to do two
// loops, so it makes sense to combine them into a single one
for (i = 0, ien = ctx.aoColumns.length; i < ien; i++) {
if ( ctx.aoColumns[i]._select_selected || (d._selected_cells && d._selected_cells[i]) ) {
if (
ctx.aoColumns[i]._select_selected ||
(d._selected_cells && d._selected_cells[i])
) {
$(d.anCells[i]).addClass(ctx._select.className);
}
}
@@ -568,16 +636,21 @@ function init ( ctx ) {
// note that column selection doesn't need to be cached and then
// reselected, as they are already selected
var rows = api.rows( { selected: true } ).ids( true ).filter( function ( d ) {
var rows = api
.rows({ selected: true })
.ids(true)
.filter(function (d) {
return d !== undefined;
});
var cells = api.cells( { selected: true } ).eq(0).map( function ( cellIdx ) {
var cells = api
.cells({ selected: true })
.eq(0)
.map(function (cellIdx) {
var id = api.row(cellIdx.row).id(true);
return id ?
{ row: id, column: cellIdx.column } :
undefined;
} ).filter( function ( d ) {
return id ? { row: id, column: cellIdx.column } : undefined;
})
.filter(function (d) {
return d !== undefined;
});
@@ -597,14 +670,17 @@ function init ( ctx ) {
// Update the table information element with selected item summary
api.on('draw.dtSelect.dt select.dtSelect.dt deselect.dtSelect.dt info.dt', function () {
info(api);
api.state.save();
});
// Clean up and release
api.on('destroy.dtSelect', function () {
api.rows({selected: true}).deselect();
// Remove class directly rather than calling deselect - which would trigger events
$(api.rows({ selected: true }).nodes()).removeClass(api.settings()[0]._select.className);
disableMouseSelection(api);
api.off('.dtSelect');
$('body').off('.dtSelect' + _safeId(api.table().node()));
});
}
@@ -618,8 +694,7 @@ function init ( ctx ) {
* @param {object} last Item index to select from
* @private
*/
function rowColumnRange( dt, type, idx, last )
{
function rowColumnRange(dt, type, idx, last) {
// Add a range of rows from the last selected row to this one
var indexes = dt[type + 's']({ search: 'applied' }).indexes();
var idx1 = $.inArray(last, indexes);
@@ -661,8 +736,7 @@ function rowColumnRange( dt, type, idx, last )
* of selection style
* @private
*/
function clear( ctx, force )
{
function clear(ctx, force) {
if (force || ctx._select.style === 'single') {
var api = new DataTable.Api(ctx);
@@ -682,8 +756,7 @@ function clear( ctx, force )
* @param {int|object} idx Index of the item to select
* @private
*/
function typeSelect ( e, dt, ctx, type, idx )
{
function typeSelect(e, dt, ctx, type, idx) {
var style = dt.select.style();
var toggleable = dt.select.toggleable();
var isSelected = dt[type](idx, { selected: true }).any();
@@ -702,9 +775,11 @@ function typeSelect ( e, dt, ctx, type, idx )
cellRange(dt, idx, ctx._select_lastCell || null);
}
else {
rowColumnRange( dt, type, idx, ctx._select_lastCell ?
ctx._select_lastCell[type] :
null
rowColumnRange(
dt,
type,
idx,
ctx._select_lastCell ? ctx._select_lastCell[type] : null
);
}
}
@@ -721,15 +796,18 @@ function typeSelect ( e, dt, ctx, type, idx )
dt[type](idx).select();
}
}
} else if ( style == 'multi+shift' ) {
}
else if (style == 'multi+shift') {
if (e.shiftKey) {
if (type === 'cell') {
cellRange(dt, idx, ctx._select_lastCell || null);
}
else {
rowColumnRange( dt, type, idx, ctx._select_lastCell ?
ctx._select_lastCell[type] :
null
rowColumnRange(
dt,
type,
idx,
ctx._select_lastCell ? ctx._select_lastCell[type] : null
);
}
}
@@ -746,8 +824,6 @@ function _safeId( node ) {
return node.id.replace(/[^a-zA-Z0-9\-\_]/g, '-');
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables selectors
*/
@@ -755,10 +831,12 @@ function _safeId( node ) {
// row and column are basically identical just assigned to different properties
// and checking a different array, so we can dynamically create the functions to
// reduce the code size
$.each( [
$.each(
[
{ type: 'row', prop: 'aoData' },
{ type: 'column', prop: 'aoColumns' }
], function ( i, o ) {
],
function (i, o) {
DataTable.ext.selector[o.type].push(function (settings, opts, indexes) {
var selected = opts.selected;
var data;
@@ -771,7 +849,8 @@ $.each( [
for (var i = 0, ien = indexes.length; i < ien; i++) {
data = settings[o.prop][indexes[i]];
if ( (selected === true && data._select_selected === true) ||
if (
(selected === true && data._select_selected === true) ||
(selected === false && !data._select_selected)
) {
out.push(indexes[i]);
@@ -780,7 +859,8 @@ $.each( [
return out;
});
} );
}
);
DataTable.ext.selector.cell.push(function (settings, opts, cells) {
var selected = opts.selected;
@@ -794,8 +874,12 @@ DataTable.ext.selector.cell.push( function ( settings, opts, cells ) {
for (var i = 0, ien = cells.length; i < ien; i++) {
rowData = settings.aoData[cells[i].row];
if ( (selected === true && rowData._selected_cells && rowData._selected_cells[ cells[i].column ] === true) ||
(selected === false && ( ! rowData._selected_cells || ! rowData._selected_cells[ cells[i].column ] ) )
if (
(selected === true &&
rowData._selected_cells &&
rowData._selected_cells[cells[i].column] === true) ||
(selected === false &&
(!rowData._selected_cells || !rowData._selected_cells[cells[i].column]))
) {
out.push(cells[i]);
}
@@ -804,8 +888,6 @@ DataTable.ext.selector.cell.push( function ( settings, opts, cells ) {
return out;
});
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* DataTables API
*
@@ -873,12 +955,16 @@ apiRegister( 'select.style()', function ( style ) {
}
return this.iterator('table', function (ctx) {
ctx._select.style = style;
if (!ctx._select) {
DataTable.select.init(new DataTable.Api(ctx));
}
if (!ctx._select_init) {
init(ctx);
}
ctx._select.style = style;
// Add / remove mouse event handlers. They aren't required when only
// API selection is available
var dt = new DataTable.Api(ctx);
@@ -908,8 +994,6 @@ apiRegister( 'select.selector()', function ( selector ) {
});
});
apiRegisterPlural('rows().select()', 'row().select()', function (select) {
var api = this;
@@ -931,6 +1015,16 @@ apiRegisterPlural( 'rows().select()', 'row().select()', function ( select ) {
return this;
});
apiRegister('row().selected()', function () {
var ctx = this.context[0];
if (ctx && this.length && ctx.aoData[this[0]] && ctx.aoData[this[0]]._select_selected) {
return true;
}
return false;
});
apiRegisterPlural('columns().select()', 'column().select()', function (select) {
var api = this;
@@ -958,6 +1052,16 @@ apiRegisterPlural( 'columns().select()', 'column().select()', function ( select
return this;
});
apiRegister('column().selected()', function () {
var ctx = this.context[0];
if (ctx && this.length && ctx.aoColumns[this[0]] && ctx.aoColumns[this[0]]._select_selected) {
return true;
}
return false;
});
apiRegisterPlural('cells().select()', 'cell().select()', function (select) {
var api = this;
@@ -988,6 +1092,19 @@ apiRegisterPlural( 'cells().select()', 'cell().select()', function ( select ) {
return this;
});
apiRegister('cell().selected()', function () {
var ctx = this.context[0];
if (ctx && this.length) {
var row = ctx.aoData[this[0][0].row];
if (row && row._selected_cells && row._selected_cells[this[0][0].column]) {
return true;
}
}
return false;
});
apiRegisterPlural('rows().deselect()', 'row().deselect()', function () {
var api = this;
@@ -1020,7 +1137,9 @@ apiRegisterPlural( 'columns().deselect()', 'column().deselect()', function () {
// Need to loop over each cell, rather than just using
// `column().nodes()` as cells which are individually selected should
// not have the `selected` class removed from them
api.cells( null, idx ).indexes().each( function (cellIdx) {
api.cells(null, idx)
.indexes()
.each(function (cellIdx) {
var data = ctx.aoData[cellIdx.row];
var cellSelected = data._selected_cells;
@@ -1043,7 +1162,9 @@ apiRegisterPlural( 'cells().deselect()', 'cell().deselect()', function () {
this.iterator('cell', function (ctx, rowIdx, colIdx) {
var data = ctx.aoData[rowIdx];
if (data._selected_cells !== undefined) {
data._selected_cells[colIdx] = false;
}
// Remove class only if the cells exist, and the cell is not column
// selected, in which case the class should remain (since it is selected
@@ -1060,8 +1181,6 @@ apiRegisterPlural( 'cells().deselect()', 'cell().deselect()', function () {
return this;
});
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Buttons
*/
@@ -1103,7 +1222,7 @@ $.extend( DataTable.ext.buttons, {
limitTo: ['rows', 'columns', 'cells'],
init: function (dt, node, config) {
var that = this;
config._eventNamespace = '.select'+(_buttonNamespace++);
config._eventNamespace = '.select' + _buttonNamespace++;
// .DT namespace listeners are removed by DataTables automatically
// on table destroy
@@ -1122,10 +1241,11 @@ $.extend( DataTable.ext.buttons, {
className: 'buttons-selected-single',
init: function (dt, node, config) {
var that = this;
config._eventNamespace = '.select'+(_buttonNamespace++);
config._eventNamespace = '.select' + _buttonNamespace++;
dt.on(namespacedEvents(config), function () {
var count = dt.rows( { selected: true } ).flatten().length +
var count =
dt.rows({ selected: true }).flatten().length +
dt.columns({ selected: true }).flatten().length +
dt.cells({ selected: true }).flatten().length;
@@ -1141,10 +1261,22 @@ $.extend( DataTable.ext.buttons, {
selectAll: {
text: i18n('selectAll', 'Select all'),
className: 'buttons-select-all',
action: function () {
action: function (e, dt, node, config) {
var items = this.select.items();
var mod = config.selectorModifier;
if (mod) {
if (typeof mod === 'function') {
mod = mod.call(dt, e, dt, node, config);
}
this[items + 's'](mod).select();
}
else {
this[items + 's']().select();
}
}
// selectorModifier can be specified
},
selectNone: {
text: i18n('selectNone', 'Deselect all'),
@@ -1154,10 +1286,11 @@ $.extend( DataTable.ext.buttons, {
},
init: function (dt, node, config) {
var that = this;
config._eventNamespace = '.select'+(_buttonNamespace++);
config._eventNamespace = '.select' + _buttonNamespace++;
dt.on(namespacedEvents(config), function () {
var count = dt.rows( { selected: true } ).flatten().length +
var count =
dt.rows({ selected: true }).flatten().length +
dt.columns({ selected: true }).flatten().length +
dt.cells({ selected: true }).flatten().length;
@@ -1169,6 +1302,44 @@ $.extend( DataTable.ext.buttons, {
destroy: function (dt, node, config) {
dt.off(config._eventNamespace);
}
},
showSelected: {
text: i18n('showSelected', 'Show only selected'),
className: 'buttons-show-selected',
action: function (e, dt, node, conf) {
// Works by having a filtering function which will reduce to the selected
// items only. So we can re-reference the function it gets stored in the
// `conf` object
if (conf._filter) {
var idx = DataTable.ext.search.indexOf(conf._filter);
if (idx !== -1) {
DataTable.ext.search.splice(idx, 1);
conf._filter = null;
}
this.active(false);
}
else {
var fn = function (s, data, idx) {
// Need to be sure we are operating on our table!
if (s !== dt.settings()[0]) {
return true;
}
let row = s.aoData[idx];
return row._select_selected;
};
conf._filter = fn;
DataTable.ext.search.push(fn);
this.active(true);
}
dt.draw();
}
}
});
@@ -1191,7 +1362,7 @@ $.each( [ 'Row', 'Column', 'Cell' ], function ( i, item ) {
};
});
$.fn.DataTable.select = DataTable.select;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Initialisation
@@ -1210,5 +1381,5 @@ $(document).on( 'preInit.dt.dtSelect', function (e, ctx) {
});
return DataTable.select;
return DataTable;
}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +1,47 @@
{
"name": "datatables.net-select",
"version": "1.3.3",
"description": "Select for DataTables",
"files": [
"js/**/*.js"
],
"main": "js/dataTables.select.js",
"type": "types.d.ts",
"module": "js/dataTables.select.mjs",
"types": "./types/types.d.ts",
"version": "1.7.1",
"files": [
"js/**/*.js",
"js/**/*.mjs",
"types/**/*.d.ts"
],
"keywords": [
"select",
"selection",
"DataTables",
"Datatables",
"jQuery",
"table",
"DataTables"
"filter",
"sort"
],
"dependencies": {
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
},
"moduleType": [
"globals",
"amd",
"node"
],
"ignore": [
"composer.json",
"datatables.json",
"package.json"
],
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"author": {
"name": "SpryMedia Ltd",
"url": "http://datatables.net"
},
"dependencies": {
"jquery": ">=1.7",
"datatables.net": "^1.10.15"
},
"homepage": "https://datatables.net",
"bugs": "https://datatables.net/forums",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/DataTables/Dist-DataTables-Select.git"
},
"devDependencies": {
"@types/jquery": "^3.5.1"
}
}

231
node_modules/datatables.net-select/types/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,231 @@
// Type definitions for DataTables Select
//
// Project: https://datatables.net/extensions/select/, https://datatables.net
// Definitions by:
// SpryMedia
// Jared Szechy <https://github.com/szechyjs>
/// <reference types="jquery" />
import DataTables from 'datatables.net';
export default DataTables;
type StyleType = 'api' | 'single' | 'multi' | 'os' | 'multi+shift';
declare module 'datatables.net' {
interface Config {
/*
* Select extension options
*/
select?: boolean | string | ConfigSelect;
}
interface Api<T> {
select: ApiSelect<Api<T>>
}
interface ApiSelectorModifier {
/**
* Pick rows / columns / cells which are selected
*/
selected?: boolean | undefined;
}
interface ApiRowMethods<T> {
/**
* Select a row
*/
select(): Api<T>;
/**
* Deselect a row
*/
deselect(): Api<T>;
}
interface ApiRowsMethods<T> {
/**
* Select multiple rows
*/
select(): Api<T>;
/**
* Deselect a row
*/
deselect(): Api<T>;
}
interface ApiCellMethods<T> {
/**
* Select cell
*/
select(): Api<T>;
/**
* Deselect a cell
*/
deselect(): Api<T>;
}
interface ApiCellsMethods<T> {
/**
* Select multiple cells
*/
select(): Api<T>;
/**
* Deselect cells
*/
deselect(): Api<T>;
}
interface ApiStatic {
/**
* Select static methods
*/
select: {
/**
* Initialise Select (for use on tables which were not in the document
* when they were initialised).
*/
init: <T=any>(api: Api<T>) => void;
/**
* Select version
*/
version: string;
}
}
}
interface ConfigSelect {
/**
* Indicate if the selected items will be removed when clicking outside of the table
*/
blurable?: boolean;
/**
* Set the class name that will be applied to selected items
*/
className?: string;
/**
* Enable / disable the display for item selection information in the table summary
*/
info?: boolean;
/**
* Set which table items to select (rows, columns or cells)
*/
items?: string;
/**
* Set the element selector used for mouse event capture to select items
*/
selector?: string;
/**
* Set the selection style for end user interaction with the table
*/
style?: StyleType;
}
interface ApiSelect<Api> {
/**
* Initialise Select for a DataTable after the DataTable has been constructed.
*
* @returns DataTables Api instance
*/
(): Api;
/**
* Get the blurable state for the table.
*
* @returns Current state - true if blurable, false otherwise. Note that if multiple tables are defined in the API's context, only the blurable state of the first table will be returned.
*/
blurable(): boolean;
/**
* Set the blurable state for the table's selection options.
*
* @param flag Value to set for the blurable option - true to enable, false to disable.
* @returns DataTables Api instance for chaining
*/
blurable(flag): Api;
/**
* Get the summary information display state for the table.
*
* @returns Current state - true if information summary shown, false otherwise. Note that if multiple tables are defined in the API's context, only the information state of the first table will be returned.
*/
info(): boolean;
/**
* Set the information summary display state for the table's selection options.
*
* @param flag Value to set for the information summary display state - true to enable, false to disable.
* @returns DataTables API instance for chaining.
*/
info(flag): Api;
/**
* Get the items that will be selected by user interaction (i.e. a click on the table).
*
* @returns The current item that will be selected when the user interacts with Select's event listeners - this will be the value row, column or cell.
*/
items(): string;
/**
* Set the item type that will be selected by user interaction.
*
* @param set Items to select - this must be one of row, column or cells.
* @returns DataTables API instance for chaining.
*/
items(set: string): Api;
/**
* Get the current item selector string applied to the table.
*
* @returns the item selector string being used for the table.
*/
selector(): string;
/**
* Set the table's item selector string. Note that any old selectors will be automatically removed if this is used as a selector to ensure that there are no memory leaks in unattached event listeners.
*
* @param set jQuery selector that will select the cells that can trigger item selection.
*/
selector(set: string): Api;
/**
* Get the current selection style applied to the table
*
* @returns The current selection style, this will be one of "api", "single", "multi" or "os".
*/
style(): string;
/**
* Set the table's selection style
*
* @param s Selection style to set - this must be one of "api", "single", "multi" or "os".
* @returns DataTables API instance for chaining.
*/
style(s: StyleType): Api;
/**
* Get the toggle state of Select for the given DataTable.
*
* @returns true if the item can be deselected when clicked on, false if it cannot be.
*/
toggleable(): boolean;
/**
* Set the toggle state of Select for the DataTable.
*
* @param set true to allow item deselection, false to disallow.
* @returns DataTables API instance for chaining.
*/
toggleable(set): Api;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

15675
node_modules/datatables.net/js/jquery.dataTables.mjs generated vendored Normal file

File diff suppressed because it is too large Load Diff

5
node_modules/datatables.net/js/jquery.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -2,10 +2,12 @@
"name": "datatables.net",
"description": "jQuery DataTables",
"main": "js/jquery.dataTables.js",
"module": "js/jquery.dataTables.mjs",
"types": "./types/types.d.ts",
"version": "1.11.3",
"version": "1.13.11",
"files": [
"js/**/*.js",
"js/**/*.mjs",
"types/**/*.d.ts"
],
"keywords": [
@@ -16,7 +18,7 @@
"sort"
],
"dependencies": {
"jquery": ">=1.7"
"jquery": "1.8 - 4"
},
"moduleType": [
"globals",

File diff suppressed because it is too large Load Diff

90
package-lock.json generated
View File

@@ -15,11 +15,11 @@
"c3": "^0.4.11",
"clipboard": "^2.0.11",
"d3": "^3.5.16",
"datatables.net": "^1.11.3",
"datatables.net-fixedheader": "^3.1.2",
"datatables.net-responsive": "^2.1.0",
"datatables.net-scroller": "^1.4.2",
"datatables.net-select": "^1.2.0",
"datatables.net": "^1.13.11",
"datatables.net-fixedheader": "^3.4.1",
"datatables.net-responsive": "^2.5.1",
"datatables.net-scroller": "^2.4.1",
"datatables.net-select": "^1.7.1",
"jquery": "^3.7.1",
"jquery-contextmenu": "^2.9.2",
"jquery-migrate": "^3.4.1",
@@ -125,46 +125,46 @@
"integrity": "sha512-IUqa8/ntsWQiI1TnPTnzWcwh3bJ6Orurp2LVQne9UJdiDjxeFynUuIwjJjbqsBEu3wrhcVnZblIdd9pvdM5HEQ=="
},
"node_modules/datatables.net": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.11.3.tgz",
"integrity": "sha512-VMj5qEaTebpNurySkM6jy6sGpl+s6onPK8xJhYr296R/vUBnz1+id16NVqNf9z5aR076OGcpGHCuiTuy4E05oQ==",
"version": "1.13.11",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.13.11.tgz",
"integrity": "sha512-AE6RkMXziRaqzPcu/pl3SJXeRa6fmXQG/fVjuRESujvkzqDCYEeKTTpPMuVJSGYJpPi32WGSphVNNY1G4nSN/g==",
"dependencies": {
"jquery": ">=1.7"
"jquery": "1.8 - 4"
}
},
"node_modules/datatables.net-fixedheader": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/datatables.net-fixedheader/-/datatables.net-fixedheader-3.1.8.tgz",
"integrity": "sha512-MLZgzkU6sGNSqlKuuJC/5/ps4xcmJQZILHqr5bOK/2kBEzCZzH+ZVOjudVRshnxkFn7IOTAOecMQHI6HPHFhag==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/datatables.net-fixedheader/-/datatables.net-fixedheader-3.4.1.tgz",
"integrity": "sha512-c9FJAShG5r8RJDIszWQvMFe6Ie+njfbHB9GhzOPjEF7zhbsMUQEkoYq1qW3ppOxY5psadDrT+D3f4iGM589u6w==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
"node_modules/datatables.net-responsive": {
"version": "2.2.7",
"resolved": "https://registry.npmjs.org/datatables.net-responsive/-/datatables.net-responsive-2.2.7.tgz",
"integrity": "sha512-pjZcR+AHa0GE++giRhMBSxFLKrfjP+X7etj7oZMMfMTi1gcdYdM8YP3gmpEyfLjDEg6uPJb9PRH4mQHcc8OYyA==",
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/datatables.net-responsive/-/datatables.net-responsive-2.5.1.tgz",
"integrity": "sha512-hyJb2faIzEWUX5Yn4HOSq/6NNB9SXDVbI4OU9ny+XU/2ghZEz4676spOgzpDHTdWvCfM+t1mbUsT70fDiTTr9w==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
"node_modules/datatables.net-scroller": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/datatables.net-scroller/-/datatables.net-scroller-1.5.1.tgz",
"integrity": "sha512-aMUarBCREmrSLE0n0NBmOMI55Re+EV4KMpR1rMc2l8jhoE+UQWF1Xe0AYuR4342ybesb1WW8U3RVlLdS6gQCmg==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/datatables.net-scroller/-/datatables.net-scroller-2.4.1.tgz",
"integrity": "sha512-zLtAUJUrqrLvBPADjmropapUqwIEtZcFABKgffxx50L4bcJr9yFDG4UctI4bFQJjnoRTU5iSAlyGBCxpxeqHfw==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "1.11 - 2",
"jquery": ">=1.7"
}
},
"node_modules/datatables.net-select": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/datatables.net-select/-/datatables.net-select-1.3.3.tgz",
"integrity": "sha512-M4e9Qx790IPt+tc+CLgk7gPram3i+M2OmhIkhIpp7RcZ2Ay4App4ouQZcEx3j1MTRIWxtOz47xjpWrwVfJ23YQ==",
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/datatables.net-select/-/datatables.net-select-1.7.1.tgz",
"integrity": "sha512-yC+GoBDVsnbaFTYKmZ2v5Bftc66zSZCYHbPYZb/ccdvxytEEudjc9R3wn6fgkOrVx3C2X/8keQc4a7EJvdOErg==",
"dependencies": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
@@ -371,46 +371,46 @@
"integrity": "sha512-IUqa8/ntsWQiI1TnPTnzWcwh3bJ6Orurp2LVQne9UJdiDjxeFynUuIwjJjbqsBEu3wrhcVnZblIdd9pvdM5HEQ=="
},
"datatables.net": {
"version": "1.11.3",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.11.3.tgz",
"integrity": "sha512-VMj5qEaTebpNurySkM6jy6sGpl+s6onPK8xJhYr296R/vUBnz1+id16NVqNf9z5aR076OGcpGHCuiTuy4E05oQ==",
"version": "1.13.11",
"resolved": "https://registry.npmjs.org/datatables.net/-/datatables.net-1.13.11.tgz",
"integrity": "sha512-AE6RkMXziRaqzPcu/pl3SJXeRa6fmXQG/fVjuRESujvkzqDCYEeKTTpPMuVJSGYJpPi32WGSphVNNY1G4nSN/g==",
"requires": {
"jquery": ">=1.7"
"jquery": "1.8 - 4"
}
},
"datatables.net-fixedheader": {
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/datatables.net-fixedheader/-/datatables.net-fixedheader-3.1.8.tgz",
"integrity": "sha512-MLZgzkU6sGNSqlKuuJC/5/ps4xcmJQZILHqr5bOK/2kBEzCZzH+ZVOjudVRshnxkFn7IOTAOecMQHI6HPHFhag==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/datatables.net-fixedheader/-/datatables.net-fixedheader-3.4.1.tgz",
"integrity": "sha512-c9FJAShG5r8RJDIszWQvMFe6Ie+njfbHB9GhzOPjEF7zhbsMUQEkoYq1qW3ppOxY5psadDrT+D3f4iGM589u6w==",
"requires": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
"datatables.net-responsive": {
"version": "2.2.7",
"resolved": "https://registry.npmjs.org/datatables.net-responsive/-/datatables.net-responsive-2.2.7.tgz",
"integrity": "sha512-pjZcR+AHa0GE++giRhMBSxFLKrfjP+X7etj7oZMMfMTi1gcdYdM8YP3gmpEyfLjDEg6uPJb9PRH4mQHcc8OYyA==",
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/datatables.net-responsive/-/datatables.net-responsive-2.5.1.tgz",
"integrity": "sha512-hyJb2faIzEWUX5Yn4HOSq/6NNB9SXDVbI4OU9ny+XU/2ghZEz4676spOgzpDHTdWvCfM+t1mbUsT70fDiTTr9w==",
"requires": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},
"datatables.net-scroller": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/datatables.net-scroller/-/datatables.net-scroller-1.5.1.tgz",
"integrity": "sha512-aMUarBCREmrSLE0n0NBmOMI55Re+EV4KMpR1rMc2l8jhoE+UQWF1Xe0AYuR4342ybesb1WW8U3RVlLdS6gQCmg==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/datatables.net-scroller/-/datatables.net-scroller-2.4.1.tgz",
"integrity": "sha512-zLtAUJUrqrLvBPADjmropapUqwIEtZcFABKgffxx50L4bcJr9yFDG4UctI4bFQJjnoRTU5iSAlyGBCxpxeqHfw==",
"requires": {
"datatables.net": "^1.10.15",
"datatables.net": "1.11 - 2",
"jquery": ">=1.7"
}
},
"datatables.net-select": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/datatables.net-select/-/datatables.net-select-1.3.3.tgz",
"integrity": "sha512-M4e9Qx790IPt+tc+CLgk7gPram3i+M2OmhIkhIpp7RcZ2Ay4App4ouQZcEx3j1MTRIWxtOz47xjpWrwVfJ23YQ==",
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/datatables.net-select/-/datatables.net-select-1.7.1.tgz",
"integrity": "sha512-yC+GoBDVsnbaFTYKmZ2v5Bftc66zSZCYHbPYZb/ccdvxytEEudjc9R3wn6fgkOrVx3C2X/8keQc4a7EJvdOErg==",
"requires": {
"datatables.net": "^1.10.15",
"datatables.net": "^1.13.0",
"jquery": ">=1.7"
}
},

View File

@@ -9,11 +9,11 @@
"c3": "^0.4.11",
"clipboard": "^2.0.11",
"d3": "^3.5.16",
"datatables.net": "^1.11.3",
"datatables.net-fixedheader": "^3.1.2",
"datatables.net-responsive": "^2.1.0",
"datatables.net-scroller": "^1.4.2",
"datatables.net-select": "^1.2.0",
"datatables.net": "^1.13.11",
"datatables.net-fixedheader": "^3.4.1",
"datatables.net-responsive": "^2.5.1",
"datatables.net-scroller": "^2.4.1",
"datatables.net-select": "^1.7.1",
"jquery": "^3.7.1",
"jquery-contextmenu": "^2.9.2",
"jquery-migrate": "^3.4.1",