Skip to content

Commit e4f5a2b

Browse files
committed
Update tablesorter to latest version (2.29.0)
1 parent db53fbf commit e4f5a2b

17 files changed

+263
-135
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
===
33

4+
#### v1.24.0 (2017-10-09)
5+
6+
* Upgrade tablesorter to v2.29.0
7+
48
#### v1.23.15 (2017-07-09)
59

610
* Hotfix for adding v2.28.14 instead of v2.28.15 asset data in previous release

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Simple integration of jQuery tablesorter ([Mottie's fork]) into the asset pipeline.
66

7-
Current tablesorter version: 2.28.15 (7/4/2017) [documentation]
7+
Current tablesorter version: 2.29.0 (9/27/2017) [documentation]
88

99
Any issue associated with the js/css files, please report to [Mottie's fork].
1010

lib/jquery-tablesorter/version.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module JqueryTablesorter
22
MAJOR = 1
3-
MINOR = 23
4-
TINY = 15
3+
MINOR = 24
4+
TINY = 0
55

66
VERSION = [MAJOR, MINOR, TINY].compact.join('.')
77
end

tablesorter

Submodule tablesorter updated 51 files

vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.combined.js

+77-43
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
55
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
66
*/
7-
/*! tablesorter (FORK) - updated 07-04-2017 (v2.28.15)*/
7+
/*! tablesorter (FORK) - updated 09-27-2017 (v2.29.0)*/
88
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
99
(function(factory) {
1010
if (typeof define === 'function' && define.amd) {
@@ -16,7 +16,7 @@
1616
}
1717
}(function(jQuery) {
1818

19-
/*! TableSorter (FORK) v2.28.15 *//*
19+
/*! TableSorter (FORK) v2.29.0 *//*
2020
* Client-side table sorting with ease!
2121
* @requires jQuery v1.2.6+
2222
*
@@ -40,7 +40,7 @@
4040
'use strict';
4141
var ts = $.tablesorter = {
4242

43-
version : '2.28.15',
43+
version : '2.29.0',
4444

4545
parsers : [],
4646
widgets : [],
@@ -439,10 +439,10 @@
439439
e.stopPropagation();
440440
ts.applyWidgetId( this, id );
441441
})
442-
.bind( 'applyWidgets' + namespace, function( e, init ) {
442+
.bind( 'applyWidgets' + namespace, function( e, callback ) {
443443
e.stopPropagation();
444-
// apply widgets
445-
ts.applyWidget( this, init );
444+
// apply widgets (false = not initializing)
445+
ts.applyWidget( this, false, callback );
446446
})
447447
.bind( 'refreshWidgets' + namespace, function( e, all, dontapply ) {
448448
e.stopPropagation();
@@ -479,9 +479,9 @@
479479
downTarget = null;
480480
if ( core !== true ) {
481481
$headers.addClass( namespace.slice( 1 ) + '_extra_headers' );
482-
tmp = $.fn.closest ? $headers.closest( 'table' )[ 0 ] : $headers.parents( 'table' )[ 0 ];
483-
if ( tmp && tmp.nodeName === 'TABLE' && tmp !== table ) {
484-
$( tmp ).addClass( namespace.slice( 1 ) + '_extra_table' );
482+
tmp = ts.getClosest( $headers, 'table' );
483+
if ( tmp.length && tmp[ 0 ].nodeName === 'TABLE' && tmp[ 0 ] !== table ) {
484+
$( tmp[ 0 ] ).addClass( namespace.slice( 1 ) + '_extra_table' );
485485
}
486486
}
487487
tmp = ( c.pointerDown + ' ' + c.pointerUp + ' ' + c.pointerClick + ' sort keyup ' )
@@ -533,8 +533,7 @@
533533
ts.buildCache( c );
534534
}
535535
// jQuery v1.2.6 doesn't have closest()
536-
$cell = $.fn.closest ? $( this ).closest( 'th, td' ) :
537-
/TH|TD/.test( this.nodeName ) ? $( this ) : $( this ).parents( 'th, td' );
536+
$cell = ts.getHeaderCell( $( this ) );
538537
// reference original table headers and find the same cell
539538
// don't use $headers or IE8 throws an error - see #987
540539
temp = $headers.index( $cell );
@@ -574,7 +573,7 @@
574573
'';
575574
// redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
576575
c.$headers = $( $.map( c.$table.find( c.selectorHeaders ), function( elem, index ) {
577-
var configHeaders, header, column, template, tmp,
576+
var configHeaders, header, column, template, tmp, $th,
578577
$elem = $( elem );
579578
// ignore cell (don't add it to c.$headers) if row has ignoreRow class
580579
if ( $elem.parent().hasClass( c.cssIgnoreRow ) ) { return; }
@@ -600,7 +599,9 @@
600599
if ( c.onRenderHeader ) {
601600
c.onRenderHeader.apply( $elem, [ index, c, c.$table ] );
602601
}
603-
column = parseInt( $elem.attr( 'data-column' ), 10 );
602+
// data-column stored on th or td only
603+
$th = ts.getHeaderCell( $elem );
604+
column = parseInt( $th.attr( 'data-column' ), 10 );
604605
elem.column = column;
605606
tmp = ts.getOrder( ts.getData( $elem, configHeaders, 'sortInitialOrder' ) || c.sortInitialOrder );
606607
// this may get updated numerous times if there are multiple rows
@@ -618,10 +619,9 @@
618619
}
619620
// add cell to headerList
620621
c.headerList[ index ] = elem;
622+
$elem.addClass( ts.css.header + ' ' + c.cssHeader );
621623
// add to parent in case there are multiple rows
622-
$elem
623-
.addClass( ts.css.header + ' ' + c.cssHeader )
624-
.parent()
624+
ts.getClosest( $elem, 'tr' )
625625
.addClass( ts.css.headerRow + ' ' + c.cssHeaderRow )
626626
.attr( 'role', 'row' );
627627
// allow keyboard cursor to focus on element
@@ -1179,10 +1179,29 @@
11791179
}
11801180
},
11811181

1182+
// This function does NOT return closest if the $el matches the selector
1183+
getClosest : function( $el, selector ) {
1184+
return $.fn.closest ?
1185+
$el.closest( selector ) :
1186+
$el.parents( selector ).filter( ':first' );
1187+
},
1188+
1189+
getHeaderCell : function( $el ) {
1190+
// jQuery v1.2.6 doesn't have closest()
1191+
if ( $.fn.closest ) {
1192+
return $el.closest( 'th, td' );
1193+
}
1194+
return /TH|TD/.test( $el[0].nodeName ) ?
1195+
$el :
1196+
$el.parents( 'th, td' ).filter( ':first' );
1197+
},
1198+
11821199
// nextSort (optional), lets you disable next sort text
11831200
setColumnAriaLabel : function( c, $header, nextSort ) {
11841201
if ( $header.length ) {
1185-
var column = parseInt( $header.attr( 'data-column' ), 10 ),
1202+
var $th = ts.getHeaderCell( $header ),
1203+
// data-column always stored on the th/td
1204+
column = parseInt( $th.attr( 'data-column' ), 10 ),
11861205
vars = c.sortVars[ column ],
11871206
tmp = $header.hasClass( ts.css.sortAsc ) ?
11881207
'sortAsc' :
@@ -1340,10 +1359,9 @@
13401359
$cell = $( cell ),
13411360
// update cache - format: function( s, table, cell, cellIndex )
13421361
// no closest in jQuery v1.2.6
1343-
tbodyIndex = $tbodies
1344-
.index( $.fn.closest ? $cell.closest( 'tbody' ) : $cell.parents( 'tbody' ).filter( ':first' ) ),
1362+
tbodyIndex = $tbodies.index( ts.getClosest( $cell, 'tbody' ) ),
13451363
tbcache = c.cache[ tbodyIndex ],
1346-
$row = $.fn.closest ? $cell.closest( 'tr' ) : $cell.parents( 'tr' ).filter( ':first' );
1364+
$row = ts.getClosest( $cell, 'tr' );
13471365
cell = $cell[ 0 ]; // in case cell is a jQuery object
13481366
// tbody may not exist if update is initialized while tbody is removed for processing
13491367
if ( $tbodies.length && tbodyIndex >= 0 ) {
@@ -1398,11 +1416,13 @@
13981416
if ( valid ) {
13991417
$row = $( $row );
14001418
c.$tbodies.append( $row );
1401-
} else if ( !$row ||
1419+
} else if (
1420+
!$row ||
14021421
// row is a jQuery object?
14031422
!( $row instanceof jQuery ) ||
14041423
// row contained in the table?
1405-
( $.fn.closest ? $row.closest( 'table' )[ 0 ] : $row.parents( 'table' )[ 0 ] ) !== c.table ) {
1424+
( ts.getClosest( $row, 'table' )[ 0 ] !== c.table )
1425+
) {
14061426
if ( c.debug ) {
14071427
console.error( 'addRows method requires (1) a jQuery selector reference to rows that have already ' +
14081428
'been added to the table, or (2) row HTML string to be added to a table with only one tbody' );
@@ -1549,10 +1569,10 @@
15491569
notMultiSort = !event[ c.sortMultiSortKey ],
15501570
table = c.table,
15511571
len = c.$headers.length,
1552-
// get current column index
1553-
col = parseInt( $( cell ).attr( 'data-column' ), 10 ),
1572+
// get current column index; *always* stored on th/td
1573+
$th = ts.getHeaderCell( $( cell ) ),
1574+
col = parseInt( $th.attr( 'data-column' ), 10 ),
15541575
order = c.sortVars[ col ].order;
1555-
15561576
// Only call sortStart if sorting is enabled
15571577
c.$table.triggerHandler( 'sortStart', table );
15581578
// get current column sort order
@@ -2076,7 +2096,7 @@
20762096
if ( !widget.priority ) { widget.priority = 10; }
20772097
widgets[ indx ] = widget;
20782098
} else if ( c.debug ) {
2079-
console.warn( '"' + names[ indx ] + '" widget code does not exist!' );
2099+
console.warn( '"' + names[ indx ] + '" was enabled, but the widget code has not been loaded!' );
20802100
}
20812101
}
20822102
// sort widgets by priority
@@ -2148,6 +2168,7 @@
21482168
c.widgetInit[ name[ index ] ] = false;
21492169
}
21502170
}
2171+
c.$table.triggerHandler( 'widgetRemoveEnd', table );
21512172
},
21522173

21532174
refreshWidgets : function( table, doAll, dontapply ) {
@@ -2999,7 +3020,7 @@
29993020

30003021
})(jQuery, window, document);
30013022

3002-
/*! Widget: uitheme - updated 12/8/2016 (v2.28.1) */
3023+
/*! Widget: uitheme - updated 9/27/2017 (v2.29.0) */
30033024
;(function ($) {
30043025
'use strict';
30053026
var ts = $.tablesorter || {};
@@ -3016,10 +3037,10 @@
30163037
active : '', // applied when column is sorted
30173038
hover : '', // custom css required - a defined bootstrap style may not override other classes
30183039
// icon class names
3019-
icons : '', // add 'icon-white' to make them white; this icon class is added to the <i> in the header
3040+
icons : '', // add 'bootstrap-icon-white' to make them white; this icon class is added to the <i> in the header
30203041
iconSortNone : 'bootstrap-icon-unsorted', // class name added to icon when column is not sorted
3021-
iconSortAsc : 'icon-chevron-up glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
3022-
iconSortDesc : 'icon-chevron-down glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
3042+
iconSortAsc : 'glyphicon glyphicon-chevron-up', // class name added to icon when column has ascending sort
3043+
iconSortDesc : 'glyphicon glyphicon-chevron-down', // class name added to icon when column has descending sort
30233044
filterRow : '', // filter row class
30243045
footerRow : '',
30253046
footerCells : '',
@@ -5202,7 +5223,7 @@
52025223

52035224
})( jQuery );
52045225

5205-
/*! Widget: stickyHeaders - updated 6/2/2017 (v2.28.13) *//*
5226+
/*! Widget: stickyHeaders - updated 9/27/2017 (v2.29.0) *//*
52065227
* Requires tablesorter v2.8+ and jQuery 1.4.3+
52075228
* by Rob Garrison
52085229
*/
@@ -5354,10 +5375,14 @@
53545375
});
53555376
}
53565377
},
5378+
getLeftPosition = function() {
5379+
return $attach.length ?
5380+
parseInt($attach.css('padding-left'), 10) || 0 :
5381+
$table.offset().left - parseInt($table.css('margin-left'), 10) - $(window).scrollLeft();
5382+
},
53575383
resizeHeader = function() {
53585384
$stickyWrap.css({
5359-
left : $attach.length ? parseInt($attach.css('padding-left'), 10) || 0 :
5360-
$table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft(),
5385+
left : getLeftPosition(),
53615386
width: $table.outerWidth()
53625387
});
53635388
setWidth( $table, $stickyTable );
@@ -5367,30 +5392,38 @@
53675392
if (!$table.is(':visible')) { return; } // fixes #278
53685393
// Detect nested tables - fixes #724
53695394
nestedStickyTop = $nestedSticky.length ? $nestedSticky.offset().top - $yScroll.scrollTop() + $nestedSticky.height() : 0;
5370-
var offset = $table.offset(),
5395+
var tmp,
5396+
offset = $table.offset(),
53715397
stickyOffset = getStickyOffset(c, wo),
53725398
yWindow = $.isWindow( $yScroll[0] ), // $.isWindow needs jQuery 1.4.3
5373-
xWindow = $.isWindow( $xScroll[0] ),
53745399
attachTop = $attach.length ?
53755400
( yWindow ? $yScroll.scrollTop() : $yScroll.offset().top ) :
53765401
$yScroll.scrollTop(),
53775402
captionHeight = wo.stickyHeaders_includeCaption ? 0 : $table.children( 'caption' ).height() || 0,
53785403
scrollTop = attachTop + stickyOffset + nestedStickyTop - captionHeight,
53795404
tableHeight = $table.height() - ($stickyWrap.height() + ($tfoot.height() || 0)) - captionHeight,
53805405
isVisible = ( scrollTop > offset.top ) && ( scrollTop < offset.top + tableHeight ) ? 'visible' : 'hidden',
5406+
state = isVisible === 'visible' ? ts.css.stickyVis : ts.css.stickyHide,
5407+
needsUpdating = !$stickyWrap.hasClass( state ),
53815408
cssSettings = { visibility : isVisible };
53825409
if ($attach.length) {
5410+
// attached sticky headers always need updating
5411+
needsUpdating = true;
53835412
cssSettings.top = yWindow ? scrollTop - $attach.offset().top : $attach.scrollTop();
53845413
}
5385-
if (xWindow) {
5386-
// adjust when scrolling horizontally - fixes issue #143
5387-
cssSettings.left = $table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft();
5414+
// adjust when scrolling horizontally - fixes issue #143
5415+
tmp = getLeftPosition();
5416+
if (tmp !== parseInt($stickyWrap.css('left'), 10)) {
5417+
needsUpdating = true;
5418+
cssSettings.left = tmp;
53885419
}
53895420
cssSettings.top = ( cssSettings.top || 0 ) + stickyOffset + nestedStickyTop;
5390-
$stickyWrap
5391-
.removeClass( ts.css.stickyVis + ' ' + ts.css.stickyHide )
5392-
.addClass( isVisible === 'visible' ? ts.css.stickyVis : ts.css.stickyHide )
5393-
.css(cssSettings);
5421+
if (needsUpdating) {
5422+
$stickyWrap
5423+
.removeClass( ts.css.stickyVis + ' ' + ts.css.stickyHide )
5424+
.addClass( state )
5425+
.css(cssSettings);
5426+
}
53945427
if (isVisible !== laststate || resizing) {
53955428
// make sure the column widths match
53965429
resizeHeader();
@@ -5509,7 +5542,7 @@
55095542

55105543
})(jQuery, window);
55115544

5512-
/*! Widget: resizable - updated 4/18/2017 (v2.28.8) */
5545+
/*! Widget: resizable - updated 9/27/2017 (v2.29.0) */
55135546
/*jshint browser:true, jquery:true, unused:false */
55145547
;(function ($, window) {
55155548
'use strict';
@@ -5836,6 +5869,7 @@
58365869
vars.$target = vars.$next = null;
58375870
// will update stickyHeaders, just in case, see #912
58385871
c.$table.triggerHandler('stickyHeadersUpdate');
5872+
c.$table.triggerHandler('resizableComplete');
58395873
}
58405874
};
58415875

0 commit comments

Comments
 (0)