datatables.net-scroller
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -1,2 +0,2 @@ | ||
/*! Scroller 2.1.1 | ||
/*! Scroller 2.2.0 | ||
* © SpryMedia Ltd - datatables.net/license | ||
@@ -21,3 +21,3 @@ */ | ||
if (typeof window !== 'undefined') { | ||
if (typeof window === 'undefined') { | ||
module.exports = function (root, $) { | ||
@@ -56,3 +56,3 @@ if ( ! root ) { | ||
* @description Virtual rendering for DataTables | ||
* @version 2.1.1 | ||
* @version 2.2.0 | ||
* @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
@@ -72,3 +72,2 @@ * @contact www.sprymedia.co.uk/contact | ||
/** | ||
@@ -105,3 +104,3 @@ * Scroller is a virtual rendering plug-in for DataTables which allows large | ||
* @param {object} dt DataTables settings object or API instance | ||
* @param {object} [opts={}] Configuration object for Scroller. Options | ||
* @param {object} [opts={}] Configuration object for Scroller. Options | ||
* are defined by {@link Scroller.defaults} | ||
@@ -122,14 +121,14 @@ * | ||
*/ | ||
var Scroller = function ( dt, opts ) { | ||
var Scroller = function (dt, opts) { | ||
/* Sanity check - you just know it will happen */ | ||
if ( ! (this instanceof Scroller) ) { | ||
alert( "Scroller warning: Scroller must be initialised with the 'new' keyword." ); | ||
if (!(this instanceof Scroller)) { | ||
alert("Scroller warning: Scroller must be initialised with the 'new' keyword."); | ||
return; | ||
} | ||
if ( opts === undefined ) { | ||
if (opts === undefined) { | ||
opts = {}; | ||
} | ||
var dtApi = $.fn.dataTable.Api( dt ); | ||
var dtApi = $.fn.dataTable.Api(dt); | ||
@@ -257,3 +256,3 @@ /** | ||
// only held in the `s` property. At the moment they are mixed | ||
this.s = $.extend( this.s, Scroller.oDefaults, opts ); | ||
this.s = $.extend(this.s, Scroller.oDefaults, opts); | ||
@@ -270,7 +269,7 @@ // Workaround for row height being read from height object (see above comment) | ||
this.dom = { | ||
"force": document.createElement('div'), | ||
"label": $('<div class="dts_label">0</div>'), | ||
"scroller": null, | ||
"table": null, | ||
"loader": null | ||
force: document.createElement('div'), | ||
label: $('<div class="dts_label">0</div>'), | ||
scroller: null, | ||
table: null, | ||
loader: null | ||
}; | ||
@@ -280,3 +279,3 @@ | ||
// future. Don't initialise Scroller twice on the same table | ||
if ( this.s.dt.oScroller ) { | ||
if (this.s.dt.oScroller) { | ||
return; | ||
@@ -291,5 +290,3 @@ } | ||
$.extend( Scroller.prototype, { | ||
$.extend(Scroller.prototype, { | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -308,6 +305,4 @@ * Public methods - to be exposed via the DataTables API | ||
*/ | ||
measure: function ( redraw ) | ||
{ | ||
if ( this.s.autoHeight ) | ||
{ | ||
measure: function (redraw) { | ||
if (this.s.autoHeight) { | ||
this._calcRowHeight(); | ||
@@ -318,6 +313,6 @@ } | ||
if ( heights.row ) { | ||
if (heights.row) { | ||
heights.viewport = this._parseHeight($(this.dom.scroller).css('max-height')); | ||
this.s.viewportRows = parseInt( heights.viewport / heights.row, 10 )+1; | ||
this.s.viewportRows = parseInt(heights.viewport / heights.row, 10) + 1; | ||
this.s.dt._iDisplayLength = this.s.viewportRows * this.s.displayBuffer; | ||
@@ -327,9 +322,8 @@ } | ||
var label = this.dom.label.outerHeight(); | ||
heights.xbar = this.dom.scroller.offsetHeight - this.dom.scroller.clientHeight; | ||
heights.labelHeight = label; | ||
if ( redraw === undefined || redraw ) | ||
{ | ||
this.s.dt.oInstance.fnDraw( false ); | ||
if (redraw === undefined || redraw) { | ||
this.s.dt.oInstance.fnDraw(false); | ||
} | ||
@@ -347,14 +341,14 @@ }, | ||
* } | ||
*/ | ||
pageInfo: function() | ||
{ | ||
var | ||
dt = this.s.dt, | ||
*/ | ||
pageInfo: function () { | ||
var dt = this.s.dt, | ||
iScrollTop = this.dom.scroller.scrollTop, | ||
iTotal = dt.fnRecordsDisplay(), | ||
iPossibleEnd = Math.ceil(this.pixelsToRow(iScrollTop + this.s.heights.viewport, false, this.s.ani)); | ||
iPossibleEnd = Math.ceil( | ||
this.pixelsToRow(iScrollTop + this.s.heights.viewport, false, this.s.ani) | ||
); | ||
return { | ||
start: Math.floor(this.pixelsToRow(iScrollTop, false, this.s.ani)), | ||
end: iTotal < iPossibleEnd ? iTotal-1 : iPossibleEnd-1 | ||
end: iTotal < iPossibleEnd ? iTotal - 1 : iPossibleEnd - 1 | ||
}; | ||
@@ -376,12 +370,9 @@ }, | ||
*/ | ||
pixelsToRow: function ( pixels, intParse, virtual ) | ||
{ | ||
pixelsToRow: function (pixels, intParse, virtual) { | ||
var diff = pixels - this.s.baseScrollTop; | ||
var row = virtual ? | ||
(this._domain( 'physicalToVirtual', this.s.baseScrollTop ) + diff) / this.s.heights.row : | ||
( diff / this.s.heights.row ) + this.s.baseRowTop; | ||
var row = virtual | ||
? (this._domain('physicalToVirtual', this.s.baseScrollTop) + diff) / this.s.heights.row | ||
: diff / this.s.heights.row + this.s.baseRowTop; | ||
return intParse || intParse === undefined ? | ||
parseInt( row, 10 ) : | ||
row; | ||
return intParse || intParse === undefined ? parseInt(row, 10) : row; | ||
}, | ||
@@ -395,9 +386,8 @@ | ||
*/ | ||
rowToPixels: function ( rowIdx, intParse, virtual ) | ||
{ | ||
rowToPixels: function (rowIdx, intParse, virtual) { | ||
var pixels; | ||
var diff = rowIdx - this.s.baseRowTop; | ||
if ( virtual ) { | ||
pixels = this._domain( 'virtualToPhysical', this.s.baseScrollTop ); | ||
if (virtual) { | ||
pixels = this._domain('virtualToPhysical', this.s.baseScrollTop); | ||
pixels += diff * this.s.heights.row; | ||
@@ -410,8 +400,5 @@ } | ||
return intParse || intParse === undefined ? | ||
parseInt( pixels, 10 ) : | ||
pixels; | ||
return intParse || intParse === undefined ? parseInt(pixels, 10) : pixels; | ||
}, | ||
/** | ||
@@ -423,7 +410,6 @@ * Calculate the row number that will be found at the given pixel position (y-scroll) | ||
*/ | ||
scrollToRow: function ( row, animate ) | ||
{ | ||
scrollToRow: function (row, animate) { | ||
var that = this; | ||
var ani = false; | ||
var px = this.rowToPixels( row ); | ||
var px = this.rowToPixels(row); | ||
@@ -435,11 +421,14 @@ // We need to know if the table will redraw or not before doing the | ||
// transform. | ||
var preRows = ((this.s.displayBuffer-1)/2) * this.s.viewportRows; | ||
var preRows = ((this.s.displayBuffer - 1) / 2) * this.s.viewportRows; | ||
var drawRow = row - preRows; | ||
if ( drawRow < 0 ) { | ||
if (drawRow < 0) { | ||
drawRow = 0; | ||
} | ||
if ( (px > this.s.redrawBottom || px < this.s.redrawTop) && this.s.dt._iDisplayStart !== drawRow ) { | ||
if ( | ||
(px > this.s.redrawBottom || px < this.s.redrawTop) && | ||
this.s.dt._iDisplayStart !== drawRow | ||
) { | ||
ani = true; | ||
px = this._domain( 'virtualToPhysical', row * this.s.heights.row ); | ||
px = this._domain('virtualToPhysical', row * this.s.heights.row); | ||
@@ -449,3 +438,3 @@ // If we need records outside the current draw region, but the new | ||
// for larger numbers of records), we need to force position update. | ||
if ( this.s.redrawTop < px && px < this.s.redrawBottom ) { | ||
if (this.s.redrawTop < px && px < this.s.redrawBottom) { | ||
this.s.forceReposition = true; | ||
@@ -456,22 +445,22 @@ animate = false; | ||
if ( animate === undefined || animate ) | ||
{ | ||
if (animate === undefined || animate) { | ||
this.s.ani = ani; | ||
$(this.dom.scroller).animate( { | ||
"scrollTop": px | ||
}, function () { | ||
// This needs to happen after the animation has completed and | ||
// the final scroll event fired | ||
setTimeout( function () { | ||
that.s.ani = false; | ||
}, 250 ); | ||
} ); | ||
$(this.dom.scroller).animate( | ||
{ | ||
scrollTop: px | ||
}, | ||
function () { | ||
// This needs to happen after the animation has completed and | ||
// the final scroll event fired | ||
setTimeout(function () { | ||
that.s.ani = false; | ||
}, 250); | ||
} | ||
); | ||
} | ||
else | ||
{ | ||
$(this.dom.scroller).scrollTop( px ); | ||
else { | ||
$(this.dom.scroller).scrollTop(px); | ||
} | ||
}, | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -486,4 +475,3 @@ * Constructor | ||
*/ | ||
construct: function () | ||
{ | ||
construct: function () { | ||
var that = this; | ||
@@ -493,4 +481,4 @@ var dt = this.s.dtApi; | ||
/* Sanity check */ | ||
if ( !this.s.dt.oFeatures.bPaginate ) { | ||
this.s.dt.oApi._fnLog( this.s.dt, 0, 'Pagination must be enabled for Scroller' ); | ||
if (!this.s.dt.oFeatures.bPaginate) { | ||
this.s.dt.oApi._fnLog(this.s.dt, 0, 'Pagination must be enabled for Scroller'); | ||
return; | ||
@@ -502,15 +490,15 @@ } | ||
*/ | ||
this.dom.force.style.position = "relative"; | ||
this.dom.force.style.top = "0px"; | ||
this.dom.force.style.left = "0px"; | ||
this.dom.force.style.width = "1px"; | ||
this.dom.force.style.position = 'relative'; | ||
this.dom.force.style.top = '0px'; | ||
this.dom.force.style.left = '0px'; | ||
this.dom.force.style.width = '1px'; | ||
this.dom.scroller = $('div.'+this.s.dt.oClasses.sScrollBody, this.s.dt.nTableWrapper)[0]; | ||
this.dom.scroller.appendChild( this.dom.force ); | ||
this.dom.scroller.style.position = "relative"; | ||
this.dom.scroller = $('div.' + this.s.dt.oClasses.sScrollBody, this.s.dt.nTableWrapper)[0]; | ||
this.dom.scroller.appendChild(this.dom.force); | ||
this.dom.scroller.style.position = 'relative'; | ||
this.dom.table = $('>table', this.dom.scroller)[0]; | ||
this.dom.table.style.position = "absolute"; | ||
this.dom.table.style.top = "0px"; | ||
this.dom.table.style.left = "0px"; | ||
this.dom.table.style.position = 'absolute'; | ||
this.dom.table.style.top = '0px'; | ||
this.dom.table.style.left = '0px'; | ||
@@ -521,10 +509,10 @@ // Add class to 'announce' that we are a Scroller table | ||
// Add a 'loading' indicator | ||
if ( this.s.loadingIndicator ) | ||
{ | ||
this.dom.loader = $('<div class="dataTables_processing dts_loading">'+this.s.dt.oLanguage.sLoadingRecords+'</div>') | ||
.css('display', 'none'); | ||
if (this.s.loadingIndicator) { | ||
this.dom.loader = $( | ||
'<div class="dataTables_processing dts_loading">' + | ||
this.s.dt.oLanguage.sLoadingRecords + | ||
'</div>' | ||
).css('display', 'none'); | ||
$(this.dom.scroller.parentNode) | ||
.css('position', 'relative') | ||
.append( this.dom.loader ); | ||
$(this.dom.scroller.parentNode).css('position', 'relative').append(this.dom.loader); | ||
} | ||
@@ -535,4 +523,3 @@ | ||
/* Initial size calculations */ | ||
if ( this.s.heights.row && this.s.heights.row != 'auto' ) | ||
{ | ||
if (this.s.heights.row && this.s.heights.row != 'auto') { | ||
this.s.autoHeight = false; | ||
@@ -543,5 +530,5 @@ } | ||
this.s.ingnoreScroll = true; | ||
$(this.dom.scroller).on( 'scroll.dt-scroller', function (e) { | ||
that._scroll.call( that ); | ||
} ); | ||
$(this.dom.scroller).on('scroll.dt-scroller', function (e) { | ||
that._scroll.call(that); | ||
}); | ||
@@ -551,4 +538,4 @@ // In iOS we catch the touchstart event in case the user tries to scroll | ||
$(this.dom.scroller).on('touchstart.dt-scroller', function () { | ||
that._scroll.call( that ); | ||
} ); | ||
that._scroll.call(that); | ||
}); | ||
@@ -566,6 +553,6 @@ $(this.dom.scroller) | ||
// On resize, update the information element, since the number of rows shown might change | ||
$(window).on( 'resize.dt-scroller', function () { | ||
that.measure( false ); | ||
$(window).on('resize.dt-scroller', function () { | ||
that.measure(false); | ||
that._info(); | ||
} ); | ||
}); | ||
@@ -577,4 +564,4 @@ // Add a state saving parameter to the DT state saving so we can restore the exact | ||
dt.on( 'stateSaveParams.scroller', function ( e, settings, data ) { | ||
if ( initialStateSave && loadedState ) { | ||
dt.on('stateSaveParams.scroller', function (e, settings, data) { | ||
if (initialStateSave && loadedState) { | ||
data.scroller = loadedState.scroller; | ||
@@ -596,5 +583,5 @@ initialStateSave = false; | ||
} | ||
} ); | ||
}); | ||
dt.on( 'stateLoadParams.scroller', function( e, settings, data ) { | ||
dt.on('stateLoadParams.scroller', function (e, settings, data) { | ||
if (data.scroller !== undefined) { | ||
@@ -605,3 +592,3 @@ that.scrollToRow(data.scroller.topRow); | ||
if ( loadedState && loadedState.scroller ) { | ||
if (loadedState && loadedState.scroller) { | ||
this.s.topRowFloat = loadedState.scroller.topRow; | ||
@@ -612,10 +599,10 @@ this.s.baseScrollTop = loadedState.scroller.baseScrollTop; | ||
this.measure( false ); | ||
that.s.stateSaveThrottle = that.s.dt.oApi._fnThrottle( function () { | ||
this.measure(false); | ||
that.s.stateSaveThrottle = that.s.dt.oApi._fnThrottle(function () { | ||
that.s.dtApi.state.save(); | ||
}, 500 ); | ||
}, 500); | ||
dt.on( 'init.scroller', function () { | ||
that.measure( false ); | ||
dt.on('init.scroller', function () { | ||
that.measure(false); | ||
@@ -628,18 +615,18 @@ // Setting to `jump` will instruct _draw to calculate the scroll top | ||
// Update the scroller when the DataTable is redrawn | ||
dt.on( 'draw.scroller', function () { | ||
dt.on('draw.scroller', function () { | ||
that._draw(); | ||
}); | ||
} ); | ||
}); | ||
// Set height before the draw happens, allowing everything else to update | ||
// on draw complete without worry for roder. | ||
dt.on( 'preDraw.dt.scroller', function () { | ||
dt.on('preDraw.dt.scroller', function () { | ||
that._scrollForce(); | ||
} ); | ||
}); | ||
// Destructor | ||
dt.on( 'destroy.scroller', function () { | ||
$(window).off( 'resize.dt-scroller' ); | ||
dt.on('destroy.scroller', function () { | ||
$(window).off('resize.dt-scroller'); | ||
$(that.dom.scroller).off('.dt-scroller'); | ||
$(that.s.dt.nTable).off( '.scroller' ); | ||
$(that.s.dt.nTable).off('.scroller'); | ||
@@ -649,9 +636,8 @@ $(that.s.dt.nTableWrapper).removeClass('DTS'); | ||
that.dom.table.style.position = ""; | ||
that.dom.table.style.top = ""; | ||
that.dom.table.style.left = ""; | ||
} ); | ||
that.dom.table.style.position = ''; | ||
that.dom.table.style.top = ''; | ||
that.dom.table.style.left = ''; | ||
}); | ||
}, | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -669,14 +655,19 @@ * Private methods | ||
*/ | ||
_calcRowHeight: function () | ||
{ | ||
_calcRowHeight: function () { | ||
var dt = this.s.dt; | ||
var origTable = dt.nTable; | ||
var nTable = origTable.cloneNode( false ); | ||
var tbody = $('<tbody/>').appendTo( nTable ); | ||
var nTable = origTable.cloneNode(false); | ||
var tbody = $('<tbody/>').appendTo(nTable); | ||
var container = $( | ||
'<div class="'+dt.oClasses.sWrapper+' DTS">'+ | ||
'<div class="'+dt.oClasses.sScrollWrapper+'">'+ | ||
'<div class="'+dt.oClasses.sScrollBody+'"></div>'+ | ||
'</div>'+ | ||
'</div>' | ||
'<div class="' + | ||
dt.oClasses.sWrapper + | ||
' DTS">' + | ||
'<div class="' + | ||
dt.oClasses.sScrollWrapper + | ||
'">' + | ||
'<div class="' + | ||
dt.oClasses.sScrollBody + | ||
'"></div>' + | ||
'</div>' + | ||
'</div>' | ||
); | ||
@@ -686,21 +677,21 @@ | ||
// CSS styles don't come into play - take the size of the middle row | ||
$('tbody tr:lt(4)', origTable).clone().appendTo( tbody ); | ||
var rowsCount = $('tr', tbody).length; | ||
$('tbody tr:lt(4)', origTable).clone().appendTo(tbody); | ||
var rowsCount = $('tr', tbody).length; | ||
if ( rowsCount === 1 ) { | ||
tbody.prepend('<tr><td> </td></tr>'); | ||
tbody.append('<tr><td> </td></tr>'); | ||
if (rowsCount === 1) { | ||
tbody.prepend('<tr><td> </td></tr>'); | ||
tbody.append('<tr><td> </td></tr>'); | ||
} | ||
else { | ||
for (; rowsCount < 3; rowsCount++) { | ||
tbody.append('<tr><td> </td></tr>'); | ||
} | ||
for (; rowsCount < 3; rowsCount++) { | ||
tbody.append('<tr><td> </td></tr>'); | ||
} | ||
} | ||
$('div.'+dt.oClasses.sScrollBody, container).append( nTable ); | ||
$('div.' + dt.oClasses.sScrollBody, container).append(nTable); | ||
// If initialised using `dom`, use the holding element as the insert point | ||
var insertEl = this.s.dt.nHolding || origTable.parentNode; | ||
if ( ! $(insertEl).is(':visible') ) { | ||
if (!$(insertEl).is(':visible')) { | ||
insertEl = 'body'; | ||
@@ -710,5 +701,5 @@ } | ||
// Remove form element links as they might select over others (particularly radio and checkboxes) | ||
container.find("input").removeAttr("name"); | ||
container.find('input').removeAttr('name'); | ||
container.appendTo( insertEl ); | ||
container.appendTo(insertEl); | ||
this.s.heights.row = $('tr', tbody).eq(1).outerHeight(); | ||
@@ -726,6 +717,4 @@ | ||
*/ | ||
_draw: function () | ||
{ | ||
var | ||
that = this, | ||
_draw: function () { | ||
var that = this, | ||
heights = this.s.heights, | ||
@@ -743,9 +732,14 @@ iScrollTop = this.dom.scroller.scrollTop, | ||
// If paging is reset | ||
if ( (this.s.dt.bSorted || this.s.dt.bFiltered) && displayStart === 0 && !this.s.dt._drawHold ) { | ||
if ( | ||
(this.s.dt.bSorted || this.s.dt.bFiltered) && | ||
displayStart === 0 && | ||
!this.s.dt._drawHold | ||
) { | ||
this.s.topRowFloat = 0; | ||
} | ||
iScrollTop = this.s.scrollType === 'jump' ? | ||
this._domain( 'virtualToPhysical', this.s.topRowFloat * heights.row ) : | ||
iScrollTop; | ||
iScrollTop = | ||
this.s.scrollType === 'jump' | ||
? this._domain('virtualToPhysical', this.s.topRowFloat * heights.row) | ||
: iScrollTop; | ||
@@ -758,7 +752,7 @@ // Store positional information so positional calculations can be based | ||
// Position the table in the virtual scroller | ||
var tableTop = iScrollTop - ((this.s.topRowFloat - displayStart) * heights.row); | ||
if ( displayStart === 0 ) { | ||
var tableTop = iScrollTop - (this.s.topRowFloat - displayStart) * heights.row; | ||
if (displayStart === 0) { | ||
tableTop = 0; | ||
} | ||
else if ( displayStart + displayLen >= displayEnd ) { | ||
else if (displayStart + displayLen >= displayEnd) { | ||
tableTop = heights.scroll - iTableHeight; | ||
@@ -778,3 +772,3 @@ } | ||
this.dom.table.style.top = tableTop+'px'; | ||
this.dom.table.style.top = tableTop + 'px'; | ||
@@ -789,33 +783,38 @@ /* Cache some information for the scroller */ | ||
this.s.redrawTop = iScrollTop - boundaryPx; | ||
this.s.redrawBottom = iScrollTop + boundaryPx > heights.scroll - heights.viewport - heights.row ? | ||
heights.scroll - heights.viewport - heights.row : | ||
iScrollTop + boundaryPx; | ||
this.s.redrawBottom = | ||
iScrollTop + boundaryPx > heights.scroll - heights.viewport - heights.row | ||
? heights.scroll - heights.viewport - heights.row | ||
: iScrollTop + boundaryPx; | ||
this.s.skip = false; | ||
if(that.s.ingnoreScroll) { | ||
if (that.s.ingnoreScroll) { | ||
// Restore the scrolling position that was saved by DataTable's state | ||
// saving Note that this is done on the second draw when data is Ajax | ||
// sourced, and the first draw when DOM soured | ||
if ( this.s.dt.oFeatures.bStateSave && this.s.dt.oLoadedState !== null && | ||
typeof this.s.dt.oLoadedState.scroller != 'undefined' ) | ||
{ | ||
if ( | ||
this.s.dt.oFeatures.bStateSave && | ||
this.s.dt.oLoadedState !== null && | ||
typeof this.s.dt.oLoadedState.scroller != 'undefined' | ||
) { | ||
// A quirk of DataTables is that the draw callback will occur on an | ||
// empty set if Ajax sourced, but not if server-side processing. | ||
var ajaxSourced = (this.s.dt.sAjaxSource || that.s.dt.ajax) && ! this.s.dt.oFeatures.bServerSide ? | ||
true : | ||
false; | ||
if ( ( ajaxSourced && this.s.dt.iDraw >= 2) || | ||
(!ajaxSourced && this.s.dt.iDraw >= 1) ) | ||
{ | ||
setTimeout( function () { | ||
$(that.dom.scroller).scrollTop( that.s.dt.oLoadedState.scroller.scrollTop ); | ||
var ajaxSourced = | ||
(this.s.dt.sAjaxSource || that.s.dt.ajax) && !this.s.dt.oFeatures.bServerSide | ||
? true | ||
: false; | ||
if ( | ||
(ajaxSourced && this.s.dt.iDraw >= 2) || | ||
(!ajaxSourced && this.s.dt.iDraw >= 1) | ||
) { | ||
setTimeout(function () { | ||
$(that.dom.scroller).scrollTop(that.s.dt.oLoadedState.scroller.scrollTop); | ||
// In order to prevent layout thrashing we need another | ||
// small delay | ||
setTimeout( function () { | ||
setTimeout(function () { | ||
that.s.ingnoreScroll = false; | ||
}, 0 ); | ||
}, 0 ); | ||
}, 0); | ||
}, 0); | ||
} | ||
@@ -828,10 +827,9 @@ } | ||
// Because of the order of the DT callbacks, the info update will | ||
// take precedence over the one we want here. So a 'thread' break is | ||
// needed. Only add the thread break if bInfo is set | ||
if ( this.s.dt.oFeatures.bInfo ) { | ||
setTimeout( function () { | ||
that._info.call( that ); | ||
}, 0 ); | ||
if (this.s.dt.oFeatures.bInfo) { | ||
setTimeout(function () { | ||
that._info.call(that); | ||
}, 0); | ||
} | ||
@@ -842,4 +840,4 @@ | ||
// Hide the loading indicator | ||
if ( this.dom.loader && this.s.loaderVisible ) { | ||
this.dom.loader.css( 'display', 'none' ); | ||
if (this.dom.loader && this.s.loaderVisible) { | ||
this.dom.loader.css('display', 'none'); | ||
this.s.loaderVisible = false; | ||
@@ -855,8 +853,7 @@ } | ||
* @param {string} dir Domain transform direction, `virtualToPhysical` or | ||
* `physicalToVirtual` | ||
* `physicalToVirtual` | ||
* @returns {number} Calculated transform | ||
* @private | ||
*/ | ||
_domain: function ( dir, val ) | ||
{ | ||
_domain: function (dir, val) { | ||
var heights = this.s.heights; | ||
@@ -868,3 +865,3 @@ var diff; | ||
// transform between the two, allowing the scrollbar to be linear | ||
if ( heights.virtual === heights.scroll ) { | ||
if (heights.virtual === heights.scroll) { | ||
return val; | ||
@@ -876,10 +873,10 @@ } | ||
// anyone to mouse wheel through that much. | ||
if ( val < magic ) { | ||
if (val < magic) { | ||
return val; | ||
} | ||
else if ( dir === 'virtualToPhysical' && val >= heights.virtual - magic ) { | ||
else if (dir === 'virtualToPhysical' && val >= heights.virtual - magic) { | ||
diff = heights.virtual - val; | ||
return heights.scroll - diff; | ||
} | ||
else if ( dir === 'physicalToVirtual' && val >= heights.scroll - magic ) { | ||
else if (dir === 'physicalToVirtual' && val >= heights.scroll - magic) { | ||
diff = heights.scroll - val; | ||
@@ -898,7 +895,5 @@ return heights.virtual - diff; | ||
var m = (heights.virtual - magic - magic) / (heights.scroll - magic - magic); | ||
var c = magic - (m*magic); | ||
var c = magic - m * magic; | ||
return dir === 'virtualToPhysical' ? | ||
(val-c) / m : | ||
(m*val) + c; | ||
return dir === 'virtualToPhysical' ? (val - c) / m : m * val + c; | ||
}, | ||
@@ -913,59 +908,54 @@ | ||
*/ | ||
_info: function () | ||
{ | ||
if ( !this.s.dt.oFeatures.bInfo ) | ||
{ | ||
_info: function () { | ||
if (!this.s.dt.oFeatures.bInfo) { | ||
return; | ||
} | ||
var | ||
dt = this.s.dt, | ||
var dt = this.s.dt, | ||
language = dt.oLanguage, | ||
iScrollTop = this.dom.scroller.scrollTop, | ||
iStart = Math.floor( this.pixelsToRow(iScrollTop, false, this.s.ani)+1 ), | ||
iStart = Math.floor(this.pixelsToRow(iScrollTop, false, this.s.ani) + 1), | ||
iMax = dt.fnRecordsTotal(), | ||
iTotal = dt.fnRecordsDisplay(), | ||
iPossibleEnd = Math.ceil( this.pixelsToRow(iScrollTop+this.s.heights.viewport, false, this.s.ani) ), | ||
iPossibleEnd = Math.ceil( | ||
this.pixelsToRow(iScrollTop + this.s.heights.viewport, false, this.s.ani) | ||
), | ||
iEnd = iTotal < iPossibleEnd ? iTotal : iPossibleEnd, | ||
sStart = dt.fnFormatNumber( iStart ), | ||
sEnd = dt.fnFormatNumber( iEnd ), | ||
sMax = dt.fnFormatNumber( iMax ), | ||
sTotal = dt.fnFormatNumber( iTotal ), | ||
sStart = dt.fnFormatNumber(iStart), | ||
sEnd = dt.fnFormatNumber(iEnd), | ||
sMax = dt.fnFormatNumber(iMax), | ||
sTotal = dt.fnFormatNumber(iTotal), | ||
sOut; | ||
if ( dt.fnRecordsDisplay() === 0 && | ||
dt.fnRecordsDisplay() == dt.fnRecordsTotal() ) | ||
{ | ||
if (dt.fnRecordsDisplay() === 0 && dt.fnRecordsDisplay() == dt.fnRecordsTotal()) { | ||
/* Empty record set */ | ||
sOut = language.sInfoEmpty+ language.sInfoPostFix; | ||
sOut = language.sInfoEmpty + language.sInfoPostFix; | ||
} | ||
else if ( dt.fnRecordsDisplay() === 0 ) | ||
{ | ||
else if (dt.fnRecordsDisplay() === 0) { | ||
/* Empty record set after filtering */ | ||
sOut = language.sInfoEmpty +' '+ | ||
language.sInfoFiltered.replace('_MAX_', sMax)+ | ||
language.sInfoPostFix; | ||
sOut = | ||
language.sInfoEmpty + | ||
' ' + | ||
language.sInfoFiltered.replace('_MAX_', sMax) + | ||
language.sInfoPostFix; | ||
} | ||
else if ( dt.fnRecordsDisplay() == dt.fnRecordsTotal() ) | ||
{ | ||
else if (dt.fnRecordsDisplay() == dt.fnRecordsTotal()) { | ||
/* Normal record set */ | ||
sOut = language.sInfo. | ||
replace('_START_', sStart). | ||
replace('_END_', sEnd). | ||
replace('_MAX_', sMax). | ||
replace('_TOTAL_', sTotal)+ | ||
language.sInfoPostFix; | ||
sOut = | ||
language.sInfo | ||
.replace('_START_', sStart) | ||
.replace('_END_', sEnd) | ||
.replace('_MAX_', sMax) | ||
.replace('_TOTAL_', sTotal) + language.sInfoPostFix; | ||
} | ||
else | ||
{ | ||
else { | ||
/* Record set after filtering */ | ||
sOut = language.sInfo. | ||
replace('_START_', sStart). | ||
replace('_END_', sEnd). | ||
replace('_MAX_', sMax). | ||
replace('_TOTAL_', sTotal) +' '+ | ||
language.sInfoFiltered.replace( | ||
'_MAX_', | ||
dt.fnFormatNumber(dt.fnRecordsTotal()) | ||
)+ | ||
sOut = | ||
language.sInfo | ||
.replace('_START_', sStart) | ||
.replace('_END_', sEnd) | ||
.replace('_MAX_', sMax) | ||
.replace('_TOTAL_', sTotal) + | ||
' ' + | ||
language.sInfoFiltered.replace('_MAX_', dt.fnFormatNumber(dt.fnRecordsTotal())) + | ||
language.sInfoPostFix; | ||
@@ -975,14 +965,10 @@ } | ||
var callback = language.fnInfoCallback; | ||
if ( callback ) { | ||
sOut = callback.call( dt.oInstance, | ||
dt, iStart, iEnd, iMax, iTotal, sOut | ||
); | ||
if (callback) { | ||
sOut = callback.call(dt.oInstance, dt, iStart, iEnd, iMax, iTotal, sOut); | ||
} | ||
var n = dt.aanFeatures.i; | ||
if ( typeof n != 'undefined' ) | ||
{ | ||
for ( var i=0, iLen=n.length ; i<iLen ; i++ ) | ||
{ | ||
$(n[i]).html( sOut ); | ||
if (typeof n != 'undefined') { | ||
for (var i = 0, iLen = n.length; i < iLen; i++) { | ||
$(n[i]).html(sOut); | ||
} | ||
@@ -992,3 +978,3 @@ } | ||
// DT doesn't actually (yet) trigger this event, but it will in future | ||
$(dt.nTable).triggerHandler( 'info.dt' ); | ||
$(dt.nTable).triggerHandler('info.dt'); | ||
}, | ||
@@ -1006,3 +992,3 @@ | ||
*/ | ||
_parseHeight: function(cssHeight) { | ||
_parseHeight: function (cssHeight) { | ||
var height; | ||
@@ -1018,18 +1004,16 @@ var matches = /^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(px|em|rem|vh)$/.exec(cssHeight); | ||
if ( unit === 'px' ) { | ||
if (unit === 'px') { | ||
height = value; | ||
} | ||
else if ( unit === 'vh' ) { | ||
height = ( value / 100 ) * $(window).height(); | ||
else if (unit === 'vh') { | ||
height = (value / 100) * $(window).height(); | ||
} | ||
else if ( unit === 'rem' ) { | ||
else if (unit === 'rem') { | ||
height = value * parseFloat($(':root').css('font-size')); | ||
} | ||
else if ( unit === 'em' ) { | ||
else if (unit === 'em') { | ||
height = value * parseFloat($('body').css('font-size')); | ||
} | ||
return height ? | ||
height : | ||
0; | ||
return height ? height : 0; | ||
}, | ||
@@ -1046,6 +1030,4 @@ | ||
*/ | ||
_scroll: function () | ||
{ | ||
var | ||
that = this, | ||
_scroll: function () { | ||
var that = this, | ||
heights = this.s.heights, | ||
@@ -1055,11 +1037,11 @@ iScrollTop = this.dom.scroller.scrollTop, | ||
if ( this.s.skip ) { | ||
if (this.s.skip) { | ||
return; | ||
} | ||
if ( this.s.ingnoreScroll ) { | ||
if (this.s.ingnoreScroll) { | ||
return; | ||
} | ||
if ( iScrollTop === this.s.lastScrollTop ) { | ||
if (iScrollTop === this.s.lastScrollTop) { | ||
return; | ||
@@ -1071,3 +1053,3 @@ } | ||
*/ | ||
if ( this.s.dt.bFiltered || this.s.dt.bSorted ) { | ||
if (this.s.dt.bFiltered || this.s.dt.bSorted) { | ||
this.s.lastScrollTop = 0; | ||
@@ -1084,16 +1066,16 @@ return; | ||
*/ | ||
clearTimeout( this.s.stateTO ); | ||
this.s.stateTO = setTimeout( function () { | ||
clearTimeout(this.s.stateTO); | ||
this.s.stateTO = setTimeout(function () { | ||
that.s.dtApi.state.save(); | ||
}, 250 ); | ||
}, 250); | ||
this.s.scrollType = Math.abs(iScrollTop - this.s.lastScrollTop) > heights.viewport ? | ||
'jump' : | ||
'cont'; | ||
this.s.scrollType = | ||
Math.abs(iScrollTop - this.s.lastScrollTop) > heights.viewport ? 'jump' : 'cont'; | ||
this.s.topRowFloat = this.s.scrollType === 'cont' ? | ||
this.pixelsToRow( iScrollTop, false, false ) : | ||
this._domain( 'physicalToVirtual', iScrollTop ) / heights.row; | ||
this.s.topRowFloat = | ||
this.s.scrollType === 'cont' | ||
? this.pixelsToRow(iScrollTop, false, false) | ||
: this._domain('physicalToVirtual', iScrollTop) / heights.row; | ||
if ( this.s.topRowFloat < 0 ) { | ||
if (this.s.topRowFloat < 0) { | ||
this.s.topRowFloat = 0; | ||
@@ -1105,4 +1087,8 @@ } | ||
*/ | ||
if ( this.s.forceReposition || iScrollTop < this.s.redrawTop || iScrollTop > this.s.redrawBottom ) { | ||
var preRows = Math.ceil( ((this.s.displayBuffer-1)/2) * this.s.viewportRows ); | ||
if ( | ||
this.s.forceReposition || | ||
iScrollTop < this.s.redrawTop || | ||
iScrollTop > this.s.redrawBottom | ||
) { | ||
var preRows = Math.ceil(((this.s.displayBuffer - 1) / 2) * this.s.viewportRows); | ||
@@ -1112,14 +1098,14 @@ iTopRow = parseInt(this.s.topRowFloat, 10) - preRows; | ||
if ( iTopRow <= 0 ) { | ||
if (iTopRow <= 0) { | ||
/* At the start of the table */ | ||
iTopRow = 0; | ||
} | ||
else if ( iTopRow + this.s.dt._iDisplayLength > this.s.dt.fnRecordsDisplay() ) { | ||
else if (iTopRow + this.s.dt._iDisplayLength > this.s.dt.fnRecordsDisplay()) { | ||
/* At the end of the table */ | ||
iTopRow = this.s.dt.fnRecordsDisplay() - this.s.dt._iDisplayLength; | ||
if ( iTopRow < 0 ) { | ||
if (iTopRow < 0) { | ||
iTopRow = 0; | ||
} | ||
} | ||
else if ( iTopRow % 2 !== 0 ) { | ||
else if (iTopRow % 2 !== 0) { | ||
// For the row-striping classes (odd/even) we want only to start | ||
@@ -1135,3 +1121,3 @@ // on evens otherwise the stripes will change between draws and | ||
if ( iTopRow != this.s.dt._iDisplayStart ) { | ||
if (iTopRow != this.s.dt._iDisplayStart) { | ||
/* Cache the new table position for quick lookups */ | ||
@@ -1143,3 +1129,3 @@ this.s.tableTop = $(this.s.dt.nTable).offset().top; | ||
that.s.dt._iDisplayStart = that.s.targetTop; | ||
that.s.dt.oApi._fnDraw( that.s.dt ); | ||
that.s.dt.oApi._fnDraw(that.s.dt); | ||
}; | ||
@@ -1150,7 +1136,7 @@ | ||
*/ | ||
if ( this.s.dt.oFeatures.bServerSide ) { | ||
if (this.s.dt.oFeatures.bServerSide) { | ||
this.s.forceReposition = true; | ||
clearTimeout( this.s.drawTO ); | ||
this.s.drawTO = setTimeout( draw, this.s.serverWait ); | ||
clearTimeout(this.s.drawTO); | ||
this.s.drawTO = setTimeout(draw, this.s.serverWait); | ||
} | ||
@@ -1161,4 +1147,4 @@ else { | ||
if ( this.dom.loader && ! this.s.loaderVisible ) { | ||
this.dom.loader.css( 'display', 'block' ); | ||
if (this.dom.loader && !this.s.loaderVisible) { | ||
this.dom.loader.css('display', 'block'); | ||
this.s.loaderVisible = true; | ||
@@ -1169,3 +1155,3 @@ } | ||
else { | ||
this.s.topRowFloat = this.pixelsToRow( iScrollTop, false, true ); | ||
this.s.topRowFloat = this.pixelsToRow(iScrollTop, false, true); | ||
} | ||
@@ -1176,13 +1162,13 @@ | ||
if ( this.s.scrollType === 'jump' && this.s.mousedown ) { | ||
if (this.s.scrollType === 'jump' && this.s.mousedown) { | ||
this.s.labelVisible = true; | ||
} | ||
if (this.s.labelVisible) { | ||
var labelFactor = (heights.viewport-heights.labelHeight - heights.xbar) / heights.scroll; | ||
var labelFactor = | ||
(heights.viewport - heights.labelHeight - heights.xbar) / heights.scroll; | ||
this.dom.label | ||
.html( this.s.dt.fnFormatNumber( parseInt( this.s.topRowFloat, 10 )+1 ) ) | ||
.css( 'top', iScrollTop + (iScrollTop * labelFactor) ) | ||
.css( 'right', 10 - this.dom.scroller.scrollLeft) | ||
.css( 'display', 'block' ); | ||
.html(this.s.dt.fnFormatNumber(parseInt(this.s.topRowFloat, 10) + 1)) | ||
.css('top', iScrollTop + iScrollTop * labelFactor) | ||
.css('display', 'block'); | ||
} | ||
@@ -1202,4 +1188,3 @@ }, | ||
*/ | ||
_scrollForce: function () | ||
{ | ||
_scrollForce: function () { | ||
var heights = this.s.heights; | ||
@@ -1211,3 +1196,3 @@ var max = 1000000; | ||
if ( heights.scroll > max ) { | ||
if (heights.scroll > max) { | ||
heights.scroll = max; | ||
@@ -1218,10 +1203,7 @@ } | ||
// if reduced to zero filtering) | ||
this.dom.force.style.height = heights.scroll > this.s.heights.row ? | ||
heights.scroll+'px' : | ||
this.s.heights.row+'px'; | ||
this.dom.force.style.height = | ||
heights.scroll > this.s.heights.row ? heights.scroll + 'px' : this.s.heights.row + 'px'; | ||
} | ||
} ); | ||
}); | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -1231,3 +1213,2 @@ * Statics | ||
/** | ||
@@ -1285,3 +1266,3 @@ * Scroller default settings for initialisation | ||
*/ | ||
rowHeight: "auto", | ||
rowHeight: 'auto', | ||
@@ -1301,4 +1282,2 @@ /** | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -1315,6 +1294,4 @@ * Constants | ||
*/ | ||
Scroller.version = "2.1.1"; | ||
Scroller.version = '2.2.0'; | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -1326,4 +1303,4 @@ * Initialisation | ||
// events so we can automatically initialise | ||
$(document).on( 'preInit.dt.dtscroller', function (e, settings) { | ||
if ( e.namespace !== 'dt' ) { | ||
$(document).on('preInit.dt.dtscroller', function (e, settings) { | ||
if (e.namespace !== 'dt') { | ||
return; | ||
@@ -1335,12 +1312,11 @@ } | ||
if ( init || defaults ) { | ||
var opts = $.extend( {}, init, defaults ); | ||
if (init || defaults) { | ||
var opts = $.extend({}, init, defaults); | ||
if ( init !== false ) { | ||
new Scroller( settings, opts ); | ||
if (init !== false) { | ||
new Scroller(settings, opts); | ||
} | ||
} | ||
} ); | ||
}); | ||
// Attach Scroller to DataTables so it can be accessed as an 'extra' | ||
@@ -1350,76 +1326,75 @@ $.fn.dataTable.Scroller = Scroller; | ||
// DataTables 1.10 API method aliases | ||
var Api = $.fn.dataTable.Api; | ||
Api.register( 'scroller()', function () { | ||
Api.register('scroller()', function () { | ||
return this; | ||
} ); | ||
}); | ||
// Undocumented and deprecated - is it actually useful at all? | ||
Api.register( 'scroller().rowToPixels()', function ( rowIdx, intParse, virtual ) { | ||
Api.register('scroller().rowToPixels()', function (rowIdx, intParse, virtual) { | ||
var ctx = this.context; | ||
if ( ctx.length && ctx[0].oScroller ) { | ||
return ctx[0].oScroller.rowToPixels( rowIdx, intParse, virtual ); | ||
if (ctx.length && ctx[0].oScroller) { | ||
return ctx[0].oScroller.rowToPixels(rowIdx, intParse, virtual); | ||
} | ||
// undefined | ||
} ); | ||
}); | ||
// Undocumented and deprecated - is it actually useful at all? | ||
Api.register( 'scroller().pixelsToRow()', function ( pixels, intParse, virtual ) { | ||
Api.register('scroller().pixelsToRow()', function (pixels, intParse, virtual) { | ||
var ctx = this.context; | ||
if ( ctx.length && ctx[0].oScroller ) { | ||
return ctx[0].oScroller.pixelsToRow( pixels, intParse, virtual ); | ||
if (ctx.length && ctx[0].oScroller) { | ||
return ctx[0].oScroller.pixelsToRow(pixels, intParse, virtual); | ||
} | ||
// undefined | ||
} ); | ||
}); | ||
// `scroller().scrollToRow()` is undocumented and deprecated. Use `scroller.toPosition() | ||
Api.register( ['scroller().scrollToRow()', 'scroller.toPosition()'], function ( idx, ani ) { | ||
this.iterator( 'table', function ( ctx ) { | ||
if ( ctx.oScroller ) { | ||
ctx.oScroller.scrollToRow( idx, ani ); | ||
Api.register(['scroller().scrollToRow()', 'scroller.toPosition()'], function (idx, ani) { | ||
this.iterator('table', function (ctx) { | ||
if (ctx.oScroller) { | ||
ctx.oScroller.scrollToRow(idx, ani); | ||
} | ||
} ); | ||
}); | ||
return this; | ||
} ); | ||
}); | ||
Api.register( 'row().scrollTo()', function ( ani ) { | ||
Api.register('row().scrollTo()', function (ani) { | ||
var that = this; | ||
this.iterator( 'row', function ( ctx, rowIdx ) { | ||
if ( ctx.oScroller ) { | ||
this.iterator('row', function (ctx, rowIdx) { | ||
if (ctx.oScroller) { | ||
var displayIdx = that | ||
.rows( { order: 'applied', search: 'applied' } ) | ||
.rows({ order: 'applied', search: 'applied' }) | ||
.indexes() | ||
.indexOf( rowIdx ); | ||
.indexOf(rowIdx); | ||
ctx.oScroller.scrollToRow( displayIdx, ani ); | ||
ctx.oScroller.scrollToRow(displayIdx, ani); | ||
} | ||
} ); | ||
}); | ||
return this; | ||
} ); | ||
}); | ||
Api.register( 'scroller.measure()', function ( redraw ) { | ||
this.iterator( 'table', function ( ctx ) { | ||
if ( ctx.oScroller ) { | ||
ctx.oScroller.measure( redraw ); | ||
Api.register('scroller.measure()', function (redraw) { | ||
this.iterator('table', function (ctx) { | ||
if (ctx.oScroller) { | ||
ctx.oScroller.measure(redraw); | ||
} | ||
} ); | ||
}); | ||
return this; | ||
} ); | ||
}); | ||
Api.register( 'scroller.page()', function() { | ||
Api.register('scroller.page()', function () { | ||
var ctx = this.context; | ||
if ( ctx.length && ctx[0].oScroller ) { | ||
if (ctx.length && ctx[0].oScroller) { | ||
return ctx[0].oScroller.pageInfo(); | ||
} | ||
// undefined | ||
} ); | ||
}); | ||
@@ -1426,0 +1401,0 @@ |
@@ -1,4 +0,4 @@ | ||
/*! Scroller 2.1.1 | ||
/*! Scroller 2.2.0 | ||
* © SpryMedia Ltd - datatables.net/license | ||
*/ | ||
!function(o){var e,l;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(s){return o(s,window,document)}):"object"==typeof exports?(e=require("jquery"),l=function(s,t){t.fn.dataTable||require("datatables.net")(s,t)},"undefined"!=typeof window?module.exports=function(s,t){return s=s||window,t=t||e(s),l(s,t),o(t,s,s.document)}:(l(window,e),module.exports=o(e,window,window.document))):o(jQuery,window,document)}(function(f,i,o,a){"use strict";function e(s,t){this instanceof e?(t===a&&(t={}),s=f.fn.dataTable.Api(s),this.s={dt:s.settings()[0],dtApi:s,tableTop:0,tableBottom:0,redrawTop:0,redrawBottom:0,autoHeight:!0,viewportRows:0,stateTO:null,stateSaveThrottle:function(){},drawTO:null,heights:{jump:null,page:null,virtual:null,scroll:null,row:null,viewport:null,labelHeight:0,xbar:0},topRowFloat:0,scrollDrawDiff:null,loaderVisible:!1,forceReposition:!1,baseRowTop:0,baseScrollTop:0,mousedown:!1,lastScrollTop:0},this.s=f.extend(this.s,e.oDefaults,t),this.s.heights.row=this.s.rowHeight,this.dom={force:o.createElement("div"),label:f('<div class="dts_label">0</div>'),scroller:null,table:null,loader:null},this.s.dt.oScroller||(this.s.dt.oScroller=this).construct()):alert("Scroller warning: Scroller must be initialised with the 'new' keyword.")}var l=f.fn.dataTable,s=(f.extend(e.prototype,{measure:function(s){this.s.autoHeight&&this._calcRowHeight();var t=this.s.heights,o=(t.row&&(t.viewport=this._parseHeight(f(this.dom.scroller).css("max-height")),this.s.viewportRows=parseInt(t.viewport/t.row,10)+1,this.s.dt._iDisplayLength=this.s.viewportRows*this.s.displayBuffer),this.dom.label.outerHeight());t.xbar=this.dom.scroller.offsetHeight-this.dom.scroller.clientHeight,t.labelHeight=o,s!==a&&!s||this.s.dt.oInstance.fnDraw(!1)},pageInfo:function(){var s=this.s.dt,t=this.dom.scroller.scrollTop,s=s.fnRecordsDisplay(),o=Math.ceil(this.pixelsToRow(t+this.s.heights.viewport,!1,this.s.ani));return{start:Math.floor(this.pixelsToRow(t,!1,this.s.ani)),end:s<o?s-1:o-1}},pixelsToRow:function(s,t,o){s-=this.s.baseScrollTop,o=o?(this._domain("physicalToVirtual",this.s.baseScrollTop)+s)/this.s.heights.row:s/this.s.heights.row+this.s.baseRowTop;return t||t===a?parseInt(o,10):o},rowToPixels:function(s,t,o){s-=this.s.baseRowTop,o=o?this._domain("virtualToPhysical",this.s.baseScrollTop):this.s.baseScrollTop;return o+=s*this.s.heights.row,t||t===a?parseInt(o,10):o},scrollToRow:function(s,t){var o=this,e=!1,l=this.rowToPixels(s),r=s-(this.s.displayBuffer-1)/2*this.s.viewportRows;r<0&&(r=0),(l>this.s.redrawBottom||l<this.s.redrawTop)&&this.s.dt._iDisplayStart!==r&&(e=!0,l=this._domain("virtualToPhysical",s*this.s.heights.row),this.s.redrawTop<l&&l<this.s.redrawBottom&&(t=!(this.s.forceReposition=!0))),t===a||t?(this.s.ani=e,f(this.dom.scroller).animate({scrollTop:l},function(){setTimeout(function(){o.s.ani=!1},250)})):f(this.dom.scroller).scrollTop(l)},construct:function(){var e,l,r=this,s=this.s.dtApi;this.s.dt.oFeatures.bPaginate?(this.dom.force.style.position="relative",this.dom.force.style.top="0px",this.dom.force.style.left="0px",this.dom.force.style.width="1px",this.dom.scroller=f("div."+this.s.dt.oClasses.sScrollBody,this.s.dt.nTableWrapper)[0],this.dom.scroller.appendChild(this.dom.force),this.dom.scroller.style.position="relative",this.dom.table=f(">table",this.dom.scroller)[0],this.dom.table.style.position="absolute",this.dom.table.style.top="0px",this.dom.table.style.left="0px",f(s.table().container()).addClass("dts DTS"),this.s.loadingIndicator&&(this.dom.loader=f('<div class="dataTables_processing dts_loading">'+this.s.dt.oLanguage.sLoadingRecords+"</div>").css("display","none"),f(this.dom.scroller.parentNode).css("position","relative").append(this.dom.loader)),this.dom.label.appendTo(this.dom.scroller),this.s.heights.row&&"auto"!=this.s.heights.row&&(this.s.autoHeight=!1),this.s.ingnoreScroll=!0,f(this.dom.scroller).on("scroll.dt-scroller",function(s){r._scroll.call(r)}),f(this.dom.scroller).on("touchstart.dt-scroller",function(){r._scroll.call(r)}),f(this.dom.scroller).on("mousedown.dt-scroller",function(){r.s.mousedown=!0}).on("mouseup.dt-scroller",function(){r.s.labelVisible=!1,r.s.mousedown=!1,r.dom.label.css("display","none")}),f(i).on("resize.dt-scroller",function(){r.measure(!1),r._info()}),e=!0,l=s.state.loaded(),s.on("stateSaveParams.scroller",function(s,t,o){e&&l?(o.scroller=l.scroller,e=!1,o.scroller&&(r.s.lastScrollTop=o.scroller.scrollTop)):o.scroller={topRow:r.s.topRowFloat,baseScrollTop:r.s.baseScrollTop,baseRowTop:r.s.baseRowTop,scrollTop:r.s.lastScrollTop}}),s.on("stateLoadParams.scroller",function(s,t,o){o.scroller!==a&&r.scrollToRow(o.scroller.topRow)}),l&&l.scroller&&(this.s.topRowFloat=l.scroller.topRow,this.s.baseScrollTop=l.scroller.baseScrollTop,this.s.baseRowTop=l.scroller.baseRowTop),this.measure(!1),r.s.stateSaveThrottle=r.s.dt.oApi._fnThrottle(function(){r.s.dtApi.state.save()},500),s.on("init.scroller",function(){r.measure(!1),r.s.scrollType="jump",r._draw(),s.on("draw.scroller",function(){r._draw()})}),s.on("preDraw.dt.scroller",function(){r._scrollForce()}),s.on("destroy.scroller",function(){f(i).off("resize.dt-scroller"),f(r.dom.scroller).off(".dt-scroller"),f(r.s.dt.nTable).off(".scroller"),f(r.s.dt.nTableWrapper).removeClass("DTS"),f("div.DTS_Loading",r.dom.scroller.parentNode).remove(),r.dom.table.style.position="",r.dom.table.style.top="",r.dom.table.style.left=""})):this.s.dt.oApi._fnLog(this.s.dt,0,"Pagination must be enabled for Scroller")},_calcRowHeight:function(){var s=this.s.dt,t=s.nTable,o=t.cloneNode(!1),e=f("<tbody/>").appendTo(o),l=f('<div class="'+s.oClasses.sWrapper+' DTS"><div class="'+s.oClasses.sScrollWrapper+'"><div class="'+s.oClasses.sScrollBody+'"></div></div></div>'),r=(f("tbody tr:lt(4)",t).clone().appendTo(e),f("tr",e).length);if(1===r)e.prepend("<tr><td> </td></tr>"),e.append("<tr><td> </td></tr>");else for(;r<3;r++)e.append("<tr><td> </td></tr>");f("div."+s.oClasses.sScrollBody,l).append(o);s=this.s.dt.nHolding||t.parentNode;f(s).is(":visible")||(s="body"),l.find("input").removeAttr("name"),l.appendTo(s),this.s.heights.row=f("tr",e).eq(1).outerHeight(),l.remove()},_draw:function(){var s=this,t=this.s.heights,o=this.dom.scroller.scrollTop,e=f(this.s.dt.nTable).height(),l=this.s.dt._iDisplayStart,r=this.s.dt._iDisplayLength,i=this.s.dt.fnRecordsDisplay(),a=o+t.viewport,n=(this.s.skip=!0,!this.s.dt.bSorted&&!this.s.dt.bFiltered||0!==l||this.s.dt._drawHold||(this.s.topRowFloat=0),o="jump"===this.s.scrollType?this._domain("virtualToPhysical",this.s.topRowFloat*t.row):o,this.s.baseScrollTop=o,this.s.baseRowTop=this.s.topRowFloat,o-(this.s.topRowFloat-l)*t.row),l=(0===l?n=0:i<=l+r?n=t.scroll-e:n+e<a&&(this.s.baseScrollTop+=1+((i=a-e)-n),n=i),this.dom.table.style.top=n+"px",this.s.tableTop=n,this.s.tableBottom=e+this.s.tableTop,(o-this.s.tableTop)*this.s.boundaryScale);this.s.redrawTop=o-l,this.s.redrawBottom=o+l>t.scroll-t.viewport-t.row?t.scroll-t.viewport-t.row:o+l,this.s.skip=!1,s.s.ingnoreScroll&&(this.s.dt.oFeatures.bStateSave&&null!==this.s.dt.oLoadedState&&void 0!==this.s.dt.oLoadedState.scroller?((r=!(!this.s.dt.sAjaxSource&&!s.s.dt.ajax||this.s.dt.oFeatures.bServerSide))&&2<=this.s.dt.iDraw||!r&&1<=this.s.dt.iDraw)&&setTimeout(function(){f(s.dom.scroller).scrollTop(s.s.dt.oLoadedState.scroller.scrollTop),setTimeout(function(){s.s.ingnoreScroll=!1},0)},0):s.s.ingnoreScroll=!1),this.s.dt.oFeatures.bInfo&&setTimeout(function(){s._info.call(s)},0),f(this.s.dt.nTable).triggerHandler("position.dts.dt",n),this.dom.loader&&this.s.loaderVisible&&(this.dom.loader.css("display","none"),this.s.loaderVisible=!1)},_domain:function(s,t){var o,e=this.s.heights,l=1e4;return e.virtual===e.scroll||t<l?t:"virtualToPhysical"===s&&t>=e.virtual-l?(o=e.virtual-t,e.scroll-o):"physicalToVirtual"===s&&t>=e.scroll-l?(o=e.scroll-t,e.virtual-o):(e=l-(o=(e.virtual-l-l)/(e.scroll-l-l))*l,"virtualToPhysical"===s?(t-e)/o:o*t+e)},_info:function(){if(this.s.dt.oFeatures.bInfo){var s=this.s.dt,t=s.oLanguage,o=this.dom.scroller.scrollTop,e=Math.floor(this.pixelsToRow(o,!1,this.s.ani)+1),l=s.fnRecordsTotal(),r=s.fnRecordsDisplay(),o=Math.ceil(this.pixelsToRow(o+this.s.heights.viewport,!1,this.s.ani)),o=r<o?r:o,i=s.fnFormatNumber(e),a=s.fnFormatNumber(o),n=s.fnFormatNumber(l),h=s.fnFormatNumber(r),c=0===s.fnRecordsDisplay()&&s.fnRecordsDisplay()==s.fnRecordsTotal()?t.sInfoEmpty+t.sInfoPostFix:0===s.fnRecordsDisplay()?t.sInfoEmpty+" "+t.sInfoFiltered.replace("_MAX_",n)+t.sInfoPostFix:s.fnRecordsDisplay()==s.fnRecordsTotal()?t.sInfo.replace("_START_",i).replace("_END_",a).replace("_MAX_",n).replace("_TOTAL_",h)+t.sInfoPostFix:t.sInfo.replace("_START_",i).replace("_END_",a).replace("_MAX_",n).replace("_TOTAL_",h)+" "+t.sInfoFiltered.replace("_MAX_",s.fnFormatNumber(s.fnRecordsTotal()))+t.sInfoPostFix,i=t.fnInfoCallback,d=(i&&(c=i.call(s.oInstance,s,e,o,l,r,c)),s.aanFeatures.i);if(void 0!==d)for(var p=0,u=d.length;p<u;p++)f(d[p]).html(c);f(s.nTable).triggerHandler("info.dt")}},_parseHeight:function(s){var t,o,s=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(px|em|rem|vh)$/.exec(s);return null!==s&&(o=parseFloat(s[1]),"px"===(s=s[2])?t=o:"vh"===s?t=o/100*f(i).height():"rem"===s?t=o*parseFloat(f(":root").css("font-size")):"em"===s&&(t=o*parseFloat(f("body").css("font-size"))),t)||0},_scroll:function(){var s,t=this,o=this.s.heights,e=this.dom.scroller.scrollTop;this.s.skip||this.s.ingnoreScroll||e!==this.s.lastScrollTop&&(this.s.dt.bFiltered||this.s.dt.bSorted?this.s.lastScrollTop=0:(this._info(),clearTimeout(this.s.stateTO),this.s.stateTO=setTimeout(function(){t.s.dtApi.state.save()},250),this.s.scrollType=Math.abs(e-this.s.lastScrollTop)>o.viewport?"jump":"cont",this.s.topRowFloat="cont"===this.s.scrollType?this.pixelsToRow(e,!1,!1):this._domain("physicalToVirtual",e)/o.row,this.s.topRowFloat<0&&(this.s.topRowFloat=0),this.s.forceReposition||e<this.s.redrawTop||e>this.s.redrawBottom?(s=Math.ceil((this.s.displayBuffer-1)/2*this.s.viewportRows),s=parseInt(this.s.topRowFloat,10)-s,this.s.forceReposition=!1,s<=0?s=0:s+this.s.dt._iDisplayLength>this.s.dt.fnRecordsDisplay()?(s=this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength)<0&&(s=0):s%2!=0&&s++,(this.s.targetTop=s)!=this.s.dt._iDisplayStart&&(this.s.tableTop=f(this.s.dt.nTable).offset().top,this.s.tableBottom=f(this.s.dt.nTable).height()+this.s.tableTop,s=function(){t.s.dt._iDisplayStart=t.s.targetTop,t.s.dt.oApi._fnDraw(t.s.dt)},this.s.dt.oFeatures.bServerSide?(this.s.forceReposition=!0,clearTimeout(this.s.drawTO),this.s.drawTO=setTimeout(s,this.s.serverWait)):s(),this.dom.loader&&!this.s.loaderVisible&&(this.dom.loader.css("display","block"),this.s.loaderVisible=!0))):this.s.topRowFloat=this.pixelsToRow(e,!1,!0),this.s.lastScrollTop=e,this.s.stateSaveThrottle(),"jump"===this.s.scrollType&&this.s.mousedown&&(this.s.labelVisible=!0),this.s.labelVisible&&(s=(o.viewport-o.labelHeight-o.xbar)/o.scroll,this.dom.label.html(this.s.dt.fnFormatNumber(parseInt(this.s.topRowFloat,10)+1)).css("top",e+e*s).css("right",10-this.dom.scroller.scrollLeft).css("display","block"))))},_scrollForce:function(){var s=this.s.heights;s.virtual=s.row*this.s.dt.fnRecordsDisplay(),s.scroll=s.virtual,1e6<s.scroll&&(s.scroll=1e6),this.dom.force.style.height=s.scroll>this.s.heights.row?s.scroll+"px":this.s.heights.row+"px"}}),e.oDefaults=e.defaults={boundaryScale:.5,displayBuffer:9,loadingIndicator:!1,rowHeight:"auto",serverWait:200},e.version="2.1.1",f(o).on("preInit.dt.dtscroller",function(s,t){var o;"dt"===s.namespace&&(s=t.oInit.scroller,o=l.defaults.scroller,(s||o)&&(o=f.extend({},s,o),!1!==s&&new e(t,o)))}),f.fn.dataTable.Scroller=e,f.fn.DataTable.Scroller=e,f.fn.dataTable.Api);return s.register("scroller()",function(){return this}),s.register("scroller().rowToPixels()",function(s,t,o){var e=this.context;if(e.length&&e[0].oScroller)return e[0].oScroller.rowToPixels(s,t,o)}),s.register("scroller().pixelsToRow()",function(s,t,o){var e=this.context;if(e.length&&e[0].oScroller)return e[0].oScroller.pixelsToRow(s,t,o)}),s.register(["scroller().scrollToRow()","scroller.toPosition()"],function(t,o){return this.iterator("table",function(s){s.oScroller&&s.oScroller.scrollToRow(t,o)}),this}),s.register("row().scrollTo()",function(o){var e=this;return this.iterator("row",function(s,t){s.oScroller&&(t=e.rows({order:"applied",search:"applied"}).indexes().indexOf(t),s.oScroller.scrollToRow(t,o))}),this}),s.register("scroller.measure()",function(t){return this.iterator("table",function(s){s.oScroller&&s.oScroller.measure(t)}),this}),s.register("scroller.page()",function(){var s=this.context;if(s.length&&s[0].oScroller)return s[0].oScroller.pageInfo()}),l}); | ||
!function(o){var e,l;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(s){return o(s,window,document)}):"object"==typeof exports?(e=require("jquery"),l=function(s,t){t.fn.dataTable||require("datatables.net")(s,t)},"undefined"==typeof window?module.exports=function(s,t){return s=s||window,t=t||e(s),l(s,t),o(t,s,s.document)}:(l(window,e),module.exports=o(e,window,window.document))):o(jQuery,window,document)}(function(f,i,o,a){"use strict";function e(s,t){this instanceof e?(t===a&&(t={}),s=f.fn.dataTable.Api(s),this.s={dt:s.settings()[0],dtApi:s,tableTop:0,tableBottom:0,redrawTop:0,redrawBottom:0,autoHeight:!0,viewportRows:0,stateTO:null,stateSaveThrottle:function(){},drawTO:null,heights:{jump:null,page:null,virtual:null,scroll:null,row:null,viewport:null,labelHeight:0,xbar:0},topRowFloat:0,scrollDrawDiff:null,loaderVisible:!1,forceReposition:!1,baseRowTop:0,baseScrollTop:0,mousedown:!1,lastScrollTop:0},this.s=f.extend(this.s,e.oDefaults,t),this.s.heights.row=this.s.rowHeight,this.dom={force:o.createElement("div"),label:f('<div class="dts_label">0</div>'),scroller:null,table:null,loader:null},this.s.dt.oScroller||(this.s.dt.oScroller=this).construct()):alert("Scroller warning: Scroller must be initialised with the 'new' keyword.")}var l=f.fn.dataTable,s=(f.extend(e.prototype,{measure:function(s){this.s.autoHeight&&this._calcRowHeight();var t=this.s.heights,o=(t.row&&(t.viewport=this._parseHeight(f(this.dom.scroller).css("max-height")),this.s.viewportRows=parseInt(t.viewport/t.row,10)+1,this.s.dt._iDisplayLength=this.s.viewportRows*this.s.displayBuffer),this.dom.label.outerHeight());t.xbar=this.dom.scroller.offsetHeight-this.dom.scroller.clientHeight,t.labelHeight=o,s!==a&&!s||this.s.dt.oInstance.fnDraw(!1)},pageInfo:function(){var s=this.s.dt,t=this.dom.scroller.scrollTop,s=s.fnRecordsDisplay(),o=Math.ceil(this.pixelsToRow(t+this.s.heights.viewport,!1,this.s.ani));return{start:Math.floor(this.pixelsToRow(t,!1,this.s.ani)),end:s<o?s-1:o-1}},pixelsToRow:function(s,t,o){s-=this.s.baseScrollTop,o=o?(this._domain("physicalToVirtual",this.s.baseScrollTop)+s)/this.s.heights.row:s/this.s.heights.row+this.s.baseRowTop;return t||t===a?parseInt(o,10):o},rowToPixels:function(s,t,o){s-=this.s.baseRowTop,o=o?this._domain("virtualToPhysical",this.s.baseScrollTop):this.s.baseScrollTop;return o+=s*this.s.heights.row,t||t===a?parseInt(o,10):o},scrollToRow:function(s,t){var o=this,e=!1,l=this.rowToPixels(s),r=s-(this.s.displayBuffer-1)/2*this.s.viewportRows;r<0&&(r=0),(l>this.s.redrawBottom||l<this.s.redrawTop)&&this.s.dt._iDisplayStart!==r&&(e=!0,l=this._domain("virtualToPhysical",s*this.s.heights.row),this.s.redrawTop<l&&l<this.s.redrawBottom&&(t=!(this.s.forceReposition=!0))),t===a||t?(this.s.ani=e,f(this.dom.scroller).animate({scrollTop:l},function(){setTimeout(function(){o.s.ani=!1},250)})):f(this.dom.scroller).scrollTop(l)},construct:function(){var e,l,r=this,s=this.s.dtApi;this.s.dt.oFeatures.bPaginate?(this.dom.force.style.position="relative",this.dom.force.style.top="0px",this.dom.force.style.left="0px",this.dom.force.style.width="1px",this.dom.scroller=f("div."+this.s.dt.oClasses.sScrollBody,this.s.dt.nTableWrapper)[0],this.dom.scroller.appendChild(this.dom.force),this.dom.scroller.style.position="relative",this.dom.table=f(">table",this.dom.scroller)[0],this.dom.table.style.position="absolute",this.dom.table.style.top="0px",this.dom.table.style.left="0px",f(s.table().container()).addClass("dts DTS"),this.s.loadingIndicator&&(this.dom.loader=f('<div class="dataTables_processing dts_loading">'+this.s.dt.oLanguage.sLoadingRecords+"</div>").css("display","none"),f(this.dom.scroller.parentNode).css("position","relative").append(this.dom.loader)),this.dom.label.appendTo(this.dom.scroller),this.s.heights.row&&"auto"!=this.s.heights.row&&(this.s.autoHeight=!1),this.s.ingnoreScroll=!0,f(this.dom.scroller).on("scroll.dt-scroller",function(s){r._scroll.call(r)}),f(this.dom.scroller).on("touchstart.dt-scroller",function(){r._scroll.call(r)}),f(this.dom.scroller).on("mousedown.dt-scroller",function(){r.s.mousedown=!0}).on("mouseup.dt-scroller",function(){r.s.labelVisible=!1,r.s.mousedown=!1,r.dom.label.css("display","none")}),f(i).on("resize.dt-scroller",function(){r.measure(!1),r._info()}),e=!0,l=s.state.loaded(),s.on("stateSaveParams.scroller",function(s,t,o){e&&l?(o.scroller=l.scroller,e=!1,o.scroller&&(r.s.lastScrollTop=o.scroller.scrollTop)):o.scroller={topRow:r.s.topRowFloat,baseScrollTop:r.s.baseScrollTop,baseRowTop:r.s.baseRowTop,scrollTop:r.s.lastScrollTop}}),s.on("stateLoadParams.scroller",function(s,t,o){o.scroller!==a&&r.scrollToRow(o.scroller.topRow)}),l&&l.scroller&&(this.s.topRowFloat=l.scroller.topRow,this.s.baseScrollTop=l.scroller.baseScrollTop,this.s.baseRowTop=l.scroller.baseRowTop),this.measure(!1),r.s.stateSaveThrottle=r.s.dt.oApi._fnThrottle(function(){r.s.dtApi.state.save()},500),s.on("init.scroller",function(){r.measure(!1),r.s.scrollType="jump",r._draw(),s.on("draw.scroller",function(){r._draw()})}),s.on("preDraw.dt.scroller",function(){r._scrollForce()}),s.on("destroy.scroller",function(){f(i).off("resize.dt-scroller"),f(r.dom.scroller).off(".dt-scroller"),f(r.s.dt.nTable).off(".scroller"),f(r.s.dt.nTableWrapper).removeClass("DTS"),f("div.DTS_Loading",r.dom.scroller.parentNode).remove(),r.dom.table.style.position="",r.dom.table.style.top="",r.dom.table.style.left=""})):this.s.dt.oApi._fnLog(this.s.dt,0,"Pagination must be enabled for Scroller")},_calcRowHeight:function(){var s=this.s.dt,t=s.nTable,o=t.cloneNode(!1),e=f("<tbody/>").appendTo(o),l=f('<div class="'+s.oClasses.sWrapper+' DTS"><div class="'+s.oClasses.sScrollWrapper+'"><div class="'+s.oClasses.sScrollBody+'"></div></div></div>'),r=(f("tbody tr:lt(4)",t).clone().appendTo(e),f("tr",e).length);if(1===r)e.prepend("<tr><td> </td></tr>"),e.append("<tr><td> </td></tr>");else for(;r<3;r++)e.append("<tr><td> </td></tr>");f("div."+s.oClasses.sScrollBody,l).append(o);s=this.s.dt.nHolding||t.parentNode;f(s).is(":visible")||(s="body"),l.find("input").removeAttr("name"),l.appendTo(s),this.s.heights.row=f("tr",e).eq(1).outerHeight(),l.remove()},_draw:function(){var s=this,t=this.s.heights,o=this.dom.scroller.scrollTop,e=f(this.s.dt.nTable).height(),l=this.s.dt._iDisplayStart,r=this.s.dt._iDisplayLength,i=this.s.dt.fnRecordsDisplay(),a=o+t.viewport,n=(this.s.skip=!0,!this.s.dt.bSorted&&!this.s.dt.bFiltered||0!==l||this.s.dt._drawHold||(this.s.topRowFloat=0),o="jump"===this.s.scrollType?this._domain("virtualToPhysical",this.s.topRowFloat*t.row):o,this.s.baseScrollTop=o,this.s.baseRowTop=this.s.topRowFloat,o-(this.s.topRowFloat-l)*t.row),l=(0===l?n=0:i<=l+r?n=t.scroll-e:n+e<a&&(this.s.baseScrollTop+=1+((i=a-e)-n),n=i),this.dom.table.style.top=n+"px",this.s.tableTop=n,this.s.tableBottom=e+this.s.tableTop,(o-this.s.tableTop)*this.s.boundaryScale);this.s.redrawTop=o-l,this.s.redrawBottom=o+l>t.scroll-t.viewport-t.row?t.scroll-t.viewport-t.row:o+l,this.s.skip=!1,s.s.ingnoreScroll&&(this.s.dt.oFeatures.bStateSave&&null!==this.s.dt.oLoadedState&&void 0!==this.s.dt.oLoadedState.scroller?((r=!(!this.s.dt.sAjaxSource&&!s.s.dt.ajax||this.s.dt.oFeatures.bServerSide))&&2<=this.s.dt.iDraw||!r&&1<=this.s.dt.iDraw)&&setTimeout(function(){f(s.dom.scroller).scrollTop(s.s.dt.oLoadedState.scroller.scrollTop),setTimeout(function(){s.s.ingnoreScroll=!1},0)},0):s.s.ingnoreScroll=!1),this.s.dt.oFeatures.bInfo&&setTimeout(function(){s._info.call(s)},0),f(this.s.dt.nTable).triggerHandler("position.dts.dt",n),this.dom.loader&&this.s.loaderVisible&&(this.dom.loader.css("display","none"),this.s.loaderVisible=!1)},_domain:function(s,t){var o,e=this.s.heights,l=1e4;return e.virtual===e.scroll||t<l?t:"virtualToPhysical"===s&&t>=e.virtual-l?(o=e.virtual-t,e.scroll-o):"physicalToVirtual"===s&&t>=e.scroll-l?(o=e.scroll-t,e.virtual-o):(e=l-(o=(e.virtual-l-l)/(e.scroll-l-l))*l,"virtualToPhysical"===s?(t-e)/o:o*t+e)},_info:function(){if(this.s.dt.oFeatures.bInfo){var s=this.s.dt,t=s.oLanguage,o=this.dom.scroller.scrollTop,e=Math.floor(this.pixelsToRow(o,!1,this.s.ani)+1),l=s.fnRecordsTotal(),r=s.fnRecordsDisplay(),o=Math.ceil(this.pixelsToRow(o+this.s.heights.viewport,!1,this.s.ani)),o=r<o?r:o,i=s.fnFormatNumber(e),a=s.fnFormatNumber(o),n=s.fnFormatNumber(l),h=s.fnFormatNumber(r),c=0===s.fnRecordsDisplay()&&s.fnRecordsDisplay()==s.fnRecordsTotal()?t.sInfoEmpty+t.sInfoPostFix:0===s.fnRecordsDisplay()?t.sInfoEmpty+" "+t.sInfoFiltered.replace("_MAX_",n)+t.sInfoPostFix:s.fnRecordsDisplay()==s.fnRecordsTotal()?t.sInfo.replace("_START_",i).replace("_END_",a).replace("_MAX_",n).replace("_TOTAL_",h)+t.sInfoPostFix:t.sInfo.replace("_START_",i).replace("_END_",a).replace("_MAX_",n).replace("_TOTAL_",h)+" "+t.sInfoFiltered.replace("_MAX_",s.fnFormatNumber(s.fnRecordsTotal()))+t.sInfoPostFix,i=t.fnInfoCallback,d=(i&&(c=i.call(s.oInstance,s,e,o,l,r,c)),s.aanFeatures.i);if(void 0!==d)for(var p=0,u=d.length;p<u;p++)f(d[p]).html(c);f(s.nTable).triggerHandler("info.dt")}},_parseHeight:function(s){var t,o,s=/^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(px|em|rem|vh)$/.exec(s);return null!==s&&(o=parseFloat(s[1]),"px"===(s=s[2])?t=o:"vh"===s?t=o/100*f(i).height():"rem"===s?t=o*parseFloat(f(":root").css("font-size")):"em"===s&&(t=o*parseFloat(f("body").css("font-size"))),t)||0},_scroll:function(){var s,t=this,o=this.s.heights,e=this.dom.scroller.scrollTop;this.s.skip||this.s.ingnoreScroll||e!==this.s.lastScrollTop&&(this.s.dt.bFiltered||this.s.dt.bSorted?this.s.lastScrollTop=0:(this._info(),clearTimeout(this.s.stateTO),this.s.stateTO=setTimeout(function(){t.s.dtApi.state.save()},250),this.s.scrollType=Math.abs(e-this.s.lastScrollTop)>o.viewport?"jump":"cont",this.s.topRowFloat="cont"===this.s.scrollType?this.pixelsToRow(e,!1,!1):this._domain("physicalToVirtual",e)/o.row,this.s.topRowFloat<0&&(this.s.topRowFloat=0),this.s.forceReposition||e<this.s.redrawTop||e>this.s.redrawBottom?(s=Math.ceil((this.s.displayBuffer-1)/2*this.s.viewportRows),s=parseInt(this.s.topRowFloat,10)-s,this.s.forceReposition=!1,s<=0?s=0:s+this.s.dt._iDisplayLength>this.s.dt.fnRecordsDisplay()?(s=this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength)<0&&(s=0):s%2!=0&&s++,(this.s.targetTop=s)!=this.s.dt._iDisplayStart&&(this.s.tableTop=f(this.s.dt.nTable).offset().top,this.s.tableBottom=f(this.s.dt.nTable).height()+this.s.tableTop,s=function(){t.s.dt._iDisplayStart=t.s.targetTop,t.s.dt.oApi._fnDraw(t.s.dt)},this.s.dt.oFeatures.bServerSide?(this.s.forceReposition=!0,clearTimeout(this.s.drawTO),this.s.drawTO=setTimeout(s,this.s.serverWait)):s(),this.dom.loader&&!this.s.loaderVisible&&(this.dom.loader.css("display","block"),this.s.loaderVisible=!0))):this.s.topRowFloat=this.pixelsToRow(e,!1,!0),this.s.lastScrollTop=e,this.s.stateSaveThrottle(),"jump"===this.s.scrollType&&this.s.mousedown&&(this.s.labelVisible=!0),this.s.labelVisible&&(s=(o.viewport-o.labelHeight-o.xbar)/o.scroll,this.dom.label.html(this.s.dt.fnFormatNumber(parseInt(this.s.topRowFloat,10)+1)).css("top",e+e*s).css("display","block"))))},_scrollForce:function(){var s=this.s.heights;s.virtual=s.row*this.s.dt.fnRecordsDisplay(),s.scroll=s.virtual,1e6<s.scroll&&(s.scroll=1e6),this.dom.force.style.height=s.scroll>this.s.heights.row?s.scroll+"px":this.s.heights.row+"px"}}),e.oDefaults=e.defaults={boundaryScale:.5,displayBuffer:9,loadingIndicator:!1,rowHeight:"auto",serverWait:200},e.version="2.2.0",f(o).on("preInit.dt.dtscroller",function(s,t){var o;"dt"===s.namespace&&(s=t.oInit.scroller,o=l.defaults.scroller,(s||o)&&(o=f.extend({},s,o),!1!==s&&new e(t,o)))}),f.fn.dataTable.Scroller=e,f.fn.DataTable.Scroller=e,f.fn.dataTable.Api);return s.register("scroller()",function(){return this}),s.register("scroller().rowToPixels()",function(s,t,o){var e=this.context;if(e.length&&e[0].oScroller)return e[0].oScroller.rowToPixels(s,t,o)}),s.register("scroller().pixelsToRow()",function(s,t,o){var e=this.context;if(e.length&&e[0].oScroller)return e[0].oScroller.pixelsToRow(s,t,o)}),s.register(["scroller().scrollToRow()","scroller.toPosition()"],function(t,o){return this.iterator("table",function(s){s.oScroller&&s.oScroller.scrollToRow(t,o)}),this}),s.register("row().scrollTo()",function(o){var e=this;return this.iterator("row",function(s,t){s.oScroller&&(t=e.rows({order:"applied",search:"applied"}).indexes().indexOf(t),s.oScroller.scrollToRow(t,o))}),this}),s.register("scroller.measure()",function(t){return this.iterator("table",function(s){s.oScroller&&s.oScroller.measure(t)}),this}),s.register("scroller.page()",function(){var s=this.context;if(s.length&&s[0].oScroller)return s[0].oScroller.pageInfo()}),l}); |
@@ -7,3 +7,3 @@ { | ||
"types": "./types/types.d.ts", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"files": [ | ||
@@ -24,3 +24,3 @@ "js/**/*.js", | ||
"dependencies": { | ||
"datatables.net": ">=1.12.1", | ||
"datatables.net": ">=1.13.4", | ||
"jquery": ">=1.7" | ||
@@ -27,0 +27,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
111788
2382
Updateddatatables.net@>=1.13.4