|
4 | 4 | ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
5 | 5 | █████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
6 | 6 | */
|
7 |
| -/*! tablesorter (FORK) - updated 05-26-2017 (v2.28.12)*/ |
| 7 | +/*! tablesorter (FORK) - updated 06-02-2017 (v2.28.13)*/ |
8 | 8 | /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
9 | 9 | (function(factory) {
|
10 | 10 | if (typeof define === 'function' && define.amd) {
|
|
16 | 16 | }
|
17 | 17 | }(function(jQuery) {
|
18 | 18 |
|
19 |
| -/*! TableSorter (FORK) v2.28.12 *//* |
| 19 | +/*! TableSorter (FORK) v2.28.13 *//* |
20 | 20 | * Client-side table sorting with ease!
|
21 | 21 | * @requires jQuery v1.2.6+
|
22 | 22 | *
|
|
40 | 40 | 'use strict';
|
41 | 41 | var ts = $.tablesorter = {
|
42 | 42 |
|
43 |
| - version : '2.28.12', |
| 43 | + version : '2.28.13', |
44 | 44 |
|
45 | 45 | parsers : [],
|
46 | 46 | widgets : [],
|
|
116 | 116 | cssIconNone : '', // class name added to the icon when there is no column sort
|
117 | 117 | cssIconAsc : '', // class name added to the icon when the column has an ascending sort
|
118 | 118 | cssIconDesc : '', // class name added to the icon when the column has a descending sort
|
| 119 | + cssIconDisabled : '', // class name added to the icon when the column has a disabled sort |
119 | 120 |
|
120 | 121 | // *** events
|
121 | 122 | pointerClick : 'click',
|
|
1092 | 1093 | ▀████▀ ██ █████▀ ██ ██ ██ ██████
|
1093 | 1094 | */
|
1094 | 1095 | setHeadersCss : function( c ) {
|
1095 |
| - var $sorted, indx, column, |
| 1096 | + var indx, column, |
1096 | 1097 | list = c.sortList,
|
1097 | 1098 | len = list.length,
|
1098 | 1099 | none = ts.css.sortNone + ' ' + c.cssNone,
|
1099 | 1100 | css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
|
1100 | 1101 | cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
1101 | 1102 | aria = [ 'ascending', 'descending' ],
|
1102 | 1103 | // find the footer
|
1103 |
| - $headers = c.$table |
| 1104 | + $extras = c.$table |
1104 | 1105 | .find( 'tfoot tr' )
|
1105 | 1106 | .children( 'td, th' )
|
1106 | 1107 | .add( $( c.namespace + '_extra_headers' ) )
|
1107 |
| - .removeClass( css.join( ' ' ) ); |
1108 |
| - // remove all header information |
1109 |
| - c.$headers |
1110 |
| - .add( $( 'thead ' + c.namespace + '_extra_headers' ) ) |
1111 |
| - .removeClass( css.join( ' ' ) ) |
1112 |
| - .addClass( none ) |
1113 |
| - .attr( 'aria-sort', 'none' ) |
| 1108 | + .removeClass( css.join( ' ' ) ), |
| 1109 | + // remove all header information |
| 1110 | + $sorted = c.$headers |
| 1111 | + .add( $( 'thead ' + c.namespace + '_extra_headers' ) ) |
| 1112 | + .removeClass( css.join( ' ' ) ) |
| 1113 | + .addClass( none ) |
| 1114 | + .attr( 'aria-sort', 'none' ) |
| 1115 | + .find( '.' + ts.css.icon ) |
| 1116 | + .removeClass( cssIcon.join( ' ' ) ) |
| 1117 | + .end(); |
| 1118 | + // add css none to all sortable headers |
| 1119 | + $sorted |
| 1120 | + .not( '.sorter-false' ) |
1114 | 1121 | .find( '.' + ts.css.icon )
|
1115 |
| - .removeClass( cssIcon.join( ' ' ) ) |
1116 | 1122 | .addClass( cssIcon[ 2 ] );
|
| 1123 | + // add disabled css icon class |
| 1124 | + if ( c.cssIconDisabled ) { |
| 1125 | + $sorted |
| 1126 | + .filter( '.sorter-false' ) |
| 1127 | + .find( '.' + ts.css.icon ) |
| 1128 | + .addClass( c.cssIconDisabled ); |
| 1129 | + } |
1117 | 1130 | for ( indx = 0; indx < len; indx++ ) {
|
1118 | 1131 | // direction = 2 means reset!
|
1119 | 1132 | if ( list[ indx ][ 1 ] !== 2 ) {
|
|
1150 | 1163 | }
|
1151 | 1164 | }
|
1152 | 1165 | // add sorted class to footer & extra headers, if they exist
|
1153 |
| - if ( $headers.length ) { |
1154 |
| - $headers |
| 1166 | + if ( $extras.length ) { |
| 1167 | + $extras |
1155 | 1168 | .filter( '[data-column="' + list[ indx ][ 0 ] + '"]' )
|
1156 | 1169 | .removeClass( none )
|
1157 | 1170 | .addClass( css[ list[ indx ][ 1 ] ] );
|
|
1824 | 1837 | },
|
1825 | 1838 |
|
1826 | 1839 | // Natural sort - https://github.com/overset/javascript-natural-sort (date sorting removed)
|
1827 |
| - // this function will only accept strings, or you'll see 'TypeError: undefined is not a function' |
1828 |
| - // I could add a = a.toString(); b = b.toString(); but it'll slow down the sort overall |
1829 | 1840 | sortNatural : function( a, b ) {
|
1830 | 1841 | if ( a === b ) { return 0; }
|
| 1842 | + a = a.toString(); |
| 1843 | + b = b.toString(); |
1831 | 1844 | var aNum, bNum, aFloat, bFloat, indx, max,
|
1832 | 1845 | regex = ts.regex;
|
1833 | 1846 | // first try and sort Hex codes
|
|
5152 | 5165 |
|
5153 | 5166 | })( jQuery );
|
5154 | 5167 |
|
5155 |
| -/*! Widget: stickyHeaders - updated 1/6/2017 (v2.28.4) *//* |
| 5168 | +/*! Widget: stickyHeaders - updated 6/2/2017 (v2.28.13) *//* |
5156 | 5169 | * Requires tablesorter v2.8+ and jQuery 1.4.3+
|
5157 | 5170 | * by Rob Garrison
|
5158 | 5171 | */
|
|
5209 | 5222 | }, options.timer);
|
5210 | 5223 | };
|
5211 | 5224 |
|
| 5225 | + function getStickyOffset(c, wo) { |
| 5226 | + var $el = isNaN(wo.stickyHeaders_offset) ? $(wo.stickyHeaders_offset) : []; |
| 5227 | + return $el.length ? |
| 5228 | + $el.height() || 0 : |
| 5229 | + parseInt(wo.stickyHeaders_offset, 10) || 0; |
| 5230 | + } |
| 5231 | + |
5212 | 5232 | // Sticky headers based on this awesome article:
|
5213 | 5233 | // http://css-tricks.com/13465-persistent-headers/
|
5214 | 5234 | // and https://github.com/jmosbech/StickyTableHeaders by Jonas Mosbech
|
|
5245 | 5265 | $thead = $table.children('thead:first'),
|
5246 | 5266 | $header = $thead.children('tr').not('.sticky-false').children(),
|
5247 | 5267 | $tfoot = $table.children('tfoot'),
|
5248 |
| - $stickyOffset = isNaN(wo.stickyHeaders_offset) ? $(wo.stickyHeaders_offset) : '', |
5249 |
| - stickyOffset = $stickyOffset.length ? $stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0, |
| 5268 | + stickyOffset = getStickyOffset(c, wo), |
5250 | 5269 | // is this table nested? If so, find parent sticky header wrapper (div, not table)
|
5251 | 5270 | $nestedSticky = $table.parent().closest('.' + ts.css.table).hasClass('hasStickyHeaders') ?
|
5252 | 5271 | $table.parent().closest('table.tablesorter')[0].config.widgetOptions.$sticky.parent() : [],
|
|
5268 | 5287 | $stickyThead = $stickyTable.children('thead:first'),
|
5269 | 5288 | $stickyCells,
|
5270 | 5289 | laststate = '',
|
5271 |
| - spacing = 0, |
5272 | 5290 | setWidth = function($orig, $clone){
|
5273 | 5291 | var index, width, border, $cell, $this,
|
5274 | 5292 | $cells = $orig.filter(':visible'),
|
|
5300 | 5318 | }
|
5301 | 5319 | },
|
5302 | 5320 | resizeHeader = function() {
|
5303 |
| - stickyOffset = $stickyOffset.length ? $stickyOffset.height() || 0 : parseInt(wo.stickyHeaders_offset, 10) || 0; |
5304 |
| - spacing = 0; |
5305 | 5321 | $stickyWrap.css({
|
5306 | 5322 | left : $attach.length ? parseInt($attach.css('padding-left'), 10) || 0 :
|
5307 |
| - $table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft() - spacing, |
| 5323 | + $table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft(), |
5308 | 5324 | width: $table.outerWidth()
|
5309 | 5325 | });
|
5310 | 5326 | setWidth( $table, $stickyTable );
|
|
5315 | 5331 | // Detect nested tables - fixes #724
|
5316 | 5332 | nestedStickyTop = $nestedSticky.length ? $nestedSticky.offset().top - $yScroll.scrollTop() + $nestedSticky.height() : 0;
|
5317 | 5333 | var offset = $table.offset(),
|
| 5334 | + stickyOffset = getStickyOffset(c, wo), |
5318 | 5335 | yWindow = $.isWindow( $yScroll[0] ), // $.isWindow needs jQuery 1.4.3
|
5319 | 5336 | xWindow = $.isWindow( $xScroll[0] ),
|
5320 | 5337 | attachTop = $attach.length ?
|
|
5330 | 5347 | }
|
5331 | 5348 | if (xWindow) {
|
5332 | 5349 | // adjust when scrolling horizontally - fixes issue #143
|
5333 |
| - cssSettings.left = $table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft() - spacing; |
5334 |
| - } |
5335 |
| - if ($nestedSticky.length) { |
5336 |
| - cssSettings.top = ( cssSettings.top || 0 ) + stickyOffset + nestedStickyTop; |
| 5350 | + cssSettings.left = $table.offset().left - parseInt($table.css('margin-left'), 10) - $xScroll.scrollLeft(); |
5337 | 5351 | }
|
| 5352 | + cssSettings.top = ( cssSettings.top || 0 ) + stickyOffset + nestedStickyTop; |
5338 | 5353 | $stickyWrap
|
5339 | 5354 | .removeClass( ts.css.stickyVis + ' ' + ts.css.stickyHide )
|
5340 | 5355 | .addClass( isVisible === 'visible' ? ts.css.stickyVis : ts.css.stickyHide )
|
|
5434 | 5449 | });
|
5435 | 5450 | }
|
5436 | 5451 |
|
| 5452 | + // make sure sticky is visible if page is partially scrolled |
| 5453 | + scrollSticky( true ); |
5437 | 5454 | $table.triggerHandler('stickyHeadersInit');
|
5438 | 5455 |
|
5439 | 5456 | },
|
|
0 commit comments