jquery-tablesorter 1.24.0 → 1.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd2f6d679b0523149759cc69b1b95cb25ca39e65
4
- data.tar.gz: 86b19e6a3167c07baf0d90e3ab2d8993da19c625
3
+ metadata.gz: 8dc5f32cf7e88554cda49d8163dd0da7ac6bba98
4
+ data.tar.gz: 7aa178dd8b98beaeaf5c9c416eff90018ab2e71b
5
5
  SHA512:
6
- metadata.gz: f26ac12515b165ac9e47c2cefac141a377a48f1d00be50f71bf62afc75a767d0b6ff795e3564f70465de4129119c9d3b81c2136d984edaced5fd2b9695bb6c55
7
- data.tar.gz: bb9343e62a716614e84c5ba8f450d25af4d1c6e965e02fecc2a35b7ace98654f1e7ab5025a7f9f87421c3ff075d46caa0b630ae8ccf593076394338809bd423a
6
+ metadata.gz: 64d29329c00a4241270065248042d75eb8a8d452cbce5977bfcf0a068c6f2a0bb5174d0e2acaf30a06d401bc0165c392b4cabc1e18feedd00e113b170c48c461
7
+ data.tar.gz: f1f2323544c8ac076ce18b1bca88e2ccdb54e95cd4ff704d47a52b28926c80ab790ed6fc5a829e76ad2220b8dc68ca151ae676aae11511ea282eb95b686ca156
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Simple integration of jQuery tablesorter ([Mottie's fork]) into the asset pipeline.
6
6
 
7
- Current tablesorter version: 2.29.0 (9/27/2017) [documentation]
7
+ Current tablesorter version: 2.29.2 (12/13/2017) [documentation]
8
8
 
9
9
  Any issue associated with the js/css files, please report to [Mottie's fork].
10
10
 
@@ -1,7 +1,7 @@
1
1
  module JqueryTablesorter
2
2
  MAJOR = 1
3
3
  MINOR = 24
4
- TINY = 0
4
+ TINY = 1
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].compact.join('.')
7
7
  end
@@ -4,7 +4,7 @@
4
4
  ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
5
5
  █████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
6
6
  */
7
- /*! tablesorter (FORK) - updated 09-27-2017 (v2.29.0)*/
7
+ /*! tablesorter (FORK) - updated 12-13-2017 (v2.29.2)*/
8
8
  /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
9
9
  (function(factory) {
10
10
  if (typeof define === 'function' && define.amd) {
@@ -16,7 +16,7 @@
16
16
  }
17
17
  }(function(jQuery) {
18
18
 
19
- /*! TableSorter (FORK) v2.29.0 *//*
19
+ /*! TableSorter (FORK) v2.29.2 *//*
20
20
  * Client-side table sorting with ease!
21
21
  * @requires jQuery v1.2.6+
22
22
  *
@@ -40,7 +40,7 @@
40
40
  'use strict';
41
41
  var ts = $.tablesorter = {
42
42
 
43
- version : '2.29.0',
43
+ version : '2.29.2',
44
44
 
45
45
  parsers : [],
46
46
  widgets : [],
@@ -532,8 +532,7 @@
532
532
  if ( c.delayInit && ts.isEmptyObject( c.cache ) ) {
533
533
  ts.buildCache( c );
534
534
  }
535
- // jQuery v1.2.6 doesn't have closest()
536
- $cell = ts.getHeaderCell( $( this ) );
535
+ $cell = ts.getClosest( $( this ), '.' + ts.css.header );
537
536
  // reference original table headers and find the same cell
538
537
  // don't use $headers or IE8 throws an error - see #987
539
538
  temp = $headers.index( $cell );
@@ -573,10 +572,15 @@
573
572
  '';
574
573
  // redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
575
574
  c.$headers = $( $.map( c.$table.find( c.selectorHeaders ), function( elem, index ) {
576
- var configHeaders, header, column, template, tmp, $th,
575
+ var configHeaders, header, column, template, tmp,
577
576
  $elem = $( elem );
578
577
  // ignore cell (don't add it to c.$headers) if row has ignoreRow class
579
- if ( $elem.parent().hasClass( c.cssIgnoreRow ) ) { return; }
578
+ if ( ts.getClosest( $elem, 'tr' ).hasClass( c.cssIgnoreRow ) ) { return; }
579
+ // transfer data-column to element if not th/td - #1459
580
+ if ( !/(th|td)/i.test( elem.nodeName ) ) {
581
+ tmp = ts.getClosest( $elem, 'th, td' );
582
+ $elem.attr( 'data-column', tmp.attr( 'data-column' ) );
583
+ }
580
584
  // make sure to get header cell & not column indexed cell
581
585
  configHeaders = ts.getColumnData( c.table, c.headers, index, true );
582
586
  // save original header content
@@ -599,9 +603,7 @@
599
603
  if ( c.onRenderHeader ) {
600
604
  c.onRenderHeader.apply( $elem, [ index, c, c.$table ] );
601
605
  }
602
- // data-column stored on th or td only
603
- $th = ts.getHeaderCell( $elem );
604
- column = parseInt( $th.attr( 'data-column' ), 10 );
606
+ column = parseInt( $elem.attr( 'data-column' ), 10 );
605
607
  elem.column = column;
606
608
  tmp = ts.getOrder( ts.getData( $elem, configHeaders, 'sortInitialOrder' ) || c.sortInitialOrder );
607
609
  // this may get updated numerous times if there are multiple rows
@@ -637,6 +639,7 @@
637
639
  if ( ts.isEmptyObject( c.sortVars[ indx ] ) ) {
638
640
  c.sortVars[ indx ] = {};
639
641
  }
642
+ // Use c.$headers.parent() in case selectorHeaders doesn't point to the th/td
640
643
  $temp = c.$headers.filter( '[data-column="' + indx + '"]' );
641
644
  // target sortable column cells, unless there are none, then use non-sortable cells
642
645
  // .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
@@ -1100,6 +1103,15 @@
1100
1103
  css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
1101
1104
  cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
1102
1105
  aria = [ 'ascending', 'descending' ],
1106
+ updateColumnSort = function($el, index) {
1107
+ $el
1108
+ .removeClass( none )
1109
+ .addClass( css[ index ] )
1110
+ .attr( 'aria-sort', aria[ index ] )
1111
+ .find( '.' + ts.css.icon )
1112
+ .removeClass( cssIcon[ 2 ] )
1113
+ .addClass( cssIcon[ index ] );
1114
+ },
1103
1115
  // find the footer
1104
1116
  $extras = c.$table
1105
1117
  .find( 'tfoot tr' )
@@ -1138,7 +1150,7 @@
1138
1150
  var include = true,
1139
1151
  $el = c.$headers.eq( i ),
1140
1152
  col = parseInt( $el.attr( 'data-column' ), 10 ),
1141
- end = col + c.$headers[ i ].colSpan;
1153
+ end = col + ts.getClosest( $el, 'th, td' )[0].colSpan;
1142
1154
  for ( ; col < end; col++ ) {
1143
1155
  include = include ? include || ts.isValueInArray( col, c.sortList ) > -1 : false;
1144
1156
  }
@@ -1152,23 +1164,13 @@
1152
1164
  if ( $sorted.length ) {
1153
1165
  for ( column = 0; column < $sorted.length; column++ ) {
1154
1166
  if ( !$sorted[ column ].sortDisabled ) {
1155
- $sorted
1156
- .eq( column )
1157
- .removeClass( none )
1158
- .addClass( css[ list[ indx ][ 1 ] ] )
1159
- .attr( 'aria-sort', aria[ list[ indx ][ 1 ] ] )
1160
- .find( '.' + ts.css.icon )
1161
- .removeClass( cssIcon[ 2 ] )
1162
- .addClass( cssIcon[ list[ indx ][ 1 ] ] );
1167
+ updateColumnSort( $sorted.eq( column ) , list[ indx ][ 1 ] );
1163
1168
  }
1164
1169
  }
1165
- // add sorted class to footer & extra headers, if they exist
1166
- if ( $extras.length ) {
1167
- $extras
1168
- .filter( '[data-column="' + list[ indx ][ 0 ] + '"]' )
1169
- .removeClass( none )
1170
- .addClass( css[ list[ indx ][ 1 ] ] );
1171
- }
1170
+ }
1171
+ // add sorted class to footer & extra headers, if they exist
1172
+ if ( $extras.length ) {
1173
+ updateColumnSort( $extras.filter( '[data-column="' + list[ indx ][ 0 ] + '"]' ), list[ indx ][ 1 ] );
1172
1174
  }
1173
1175
  }
1174
1176
  }
@@ -1179,29 +1181,20 @@
1179
1181
  }
1180
1182
  },
1181
1183
 
1182
- // This function does NOT return closest if the $el matches the selector
1183
1184
  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
1185
  // jQuery v1.2.6 doesn't have closest()
1191
1186
  if ( $.fn.closest ) {
1192
- return $el.closest( 'th, td' );
1187
+ return $el.closest( selector );
1193
1188
  }
1194
- return /TH|TD/.test( $el[0].nodeName ) ?
1189
+ return $el.is( selector ) ?
1195
1190
  $el :
1196
- $el.parents( 'th, td' ).filter( ':first' );
1191
+ $el.parents( selector ).filter( ':first' );
1197
1192
  },
1198
1193
 
1199
1194
  // nextSort (optional), lets you disable next sort text
1200
1195
  setColumnAriaLabel : function( c, $header, nextSort ) {
1201
1196
  if ( $header.length ) {
1202
- var $th = ts.getHeaderCell( $header ),
1203
- // data-column always stored on the th/td
1204
- column = parseInt( $th.attr( 'data-column' ), 10 ),
1197
+ var column = parseInt( $header.attr( 'data-column' ), 10 ),
1205
1198
  vars = c.sortVars[ column ],
1206
1199
  tmp = $header.hasClass( ts.css.sortAsc ) ?
1207
1200
  'sortAsc' :
@@ -1569,10 +1562,10 @@
1569
1562
  notMultiSort = !event[ c.sortMultiSortKey ],
1570
1563
  table = c.table,
1571
1564
  len = c.$headers.length,
1572
- // get current column index; *always* stored on th/td
1573
- $th = ts.getHeaderCell( $( cell ) ),
1574
- col = parseInt( $th.attr( 'data-column' ), 10 ),
1565
+ th = ts.getClosest( $( cell ), 'th, td' ),
1566
+ col = parseInt( th.attr( 'data-column' ), 10 ),
1575
1567
  order = c.sortVars[ col ].order;
1568
+ th = th[0];
1576
1569
  // Only call sortStart if sorting is enabled
1577
1570
  c.$table.triggerHandler( 'sortStart', table );
1578
1571
  // get current column sort order
@@ -1607,8 +1600,8 @@
1607
1600
  if ( dir < 2 ) {
1608
1601
  c.sortList[ c.sortList.length ] = [ col, dir ];
1609
1602
  // add other columns if header spans across multiple
1610
- if ( cell.colSpan > 1 ) {
1611
- for ( indx = 1; indx < cell.colSpan; indx++ ) {
1603
+ if ( th.colSpan > 1 ) {
1604
+ for ( indx = 1; indx < th.colSpan; indx++ ) {
1612
1605
  c.sortList[ c.sortList.length ] = [ col + indx, dir ];
1613
1606
  // update count on columns in colSpan
1614
1607
  c.sortVars[ col + indx ].count = $.inArray( dir, order );
@@ -1640,8 +1633,8 @@
1640
1633
  if ( dir < 2 ) {
1641
1634
  c.sortList[ c.sortList.length ] = [ col, dir ];
1642
1635
  // add other columns if header spans across multiple
1643
- if ( cell.colSpan > 1 ) {
1644
- for ( indx = 1; indx < cell.colSpan; indx++ ) {
1636
+ if ( th.colSpan > 1 ) {
1637
+ for ( indx = 1; indx < th.colSpan; indx++ ) {
1645
1638
  c.sortList[ c.sortList.length ] = [ col + indx, dir ];
1646
1639
  // update count on columns in colSpan
1647
1640
  c.sortVars[ col + indx ].count = $.inArray( dir, order );
@@ -2410,7 +2403,7 @@
2410
2403
  $cells = ( $headers || c.$headers ),
2411
2404
  // c.$headerIndexed is not defined initially
2412
2405
  $cell = c.$headerIndexed && c.$headerIndexed[ indx ] ||
2413
- $cells.filter( '[data-column="' + indx + '"]:last' );
2406
+ $cells.find( '[data-column="' + indx + '"]:last' );
2414
2407
  if ( typeof obj[ indx ] !== 'undefined' ) {
2415
2408
  return getCell ? obj[ indx ] : obj[ $cells.index( $cell ) ];
2416
2409
  }
@@ -3295,7 +3288,7 @@
3295
3288
 
3296
3289
  })(jQuery);
3297
3290
 
3298
- /*! Widget: filter - updated 7/4/2017 (v2.28.15) *//*
3291
+ /*! Widget: filter - updated 12/13/2017 (v2.29.1) *//*
3299
3292
  * Requires tablesorter v2.8+ and jQuery 1.7+
3300
3293
  * by Rob Garrison
3301
3294
  */
@@ -4412,6 +4405,7 @@
4412
4405
  if ( $.inArray( ffxn, vars.excludeMatch ) < 0 && matches === null ) {
4413
4406
  matches = tsf.types[ffxn]( c, data, vars );
4414
4407
  if ( matches !== null ) {
4408
+ data.matchedOn = ffxn;
4415
4409
  filterMatched = matches;
4416
4410
  }
4417
4411
  }
@@ -4459,6 +4453,7 @@
4459
4453
  tsf.multipleColumns( c, wo.filter_$anyMatch ) :
4460
4454
  [];
4461
4455
  data.$cells = data.$row.children();
4456
+ data.matchedOn = null;
4462
4457
  if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
4463
4458
  data.anyMatch = true;
4464
4459
  data.isMatch = true;
@@ -4560,7 +4555,9 @@
4560
4555
  // cycle through the different filters
4561
4556
  // filters return a boolean or null if nothing matches
4562
4557
  filterMatched = tsf.processTypes( c, data, vars );
4563
- if ( filterMatched !== null ) {
4558
+ // select with exact match; ignore "and" or "or" within the text; fixes #1486
4559
+ txt = fxn === true && (data.matchedOn === 'and' || data.matchedOn === 'or');
4560
+ if ( filterMatched !== null && !txt) {
4564
4561
  result = filterMatched;
4565
4562
  // Look for match, and add child row data for matching
4566
4563
  } else {
@@ -5542,7 +5539,7 @@
5542
5539
 
5543
5540
  })(jQuery, window);
5544
5541
 
5545
- /*! Widget: resizable - updated 9/27/2017 (v2.29.0) */
5542
+ /*! Widget: resizable - updated 12/13/2017 (v2.29.1) */
5546
5543
  /*jshint browser:true, jquery:true, unused:false */
5547
5544
  ;(function ($, window) {
5548
5545
  'use strict';
@@ -5719,7 +5716,10 @@
5719
5716
  columns = c.columns - 1,
5720
5717
  $header = $this.data( 'header' );
5721
5718
  if ( !$header ) { return; } // see #859
5722
- if ( !$header.is(':visible') ) {
5719
+ if (
5720
+ !$header.is(':visible') ||
5721
+ ( !wo.resizable_addLastColumn && ts.resizable.checkVisibleColumns(c, column) )
5722
+ ) {
5723
5723
  $this.hide();
5724
5724
  } else if ( column < columns || column === columns && wo.resizable_addLastColumn ) {
5725
5725
  $this.css({
@@ -5731,6 +5731,16 @@
5731
5731
  });
5732
5732
  },
5733
5733
 
5734
+ // Fixes #1485
5735
+ checkVisibleColumns: function( c, column ) {
5736
+ var i,
5737
+ len = 0;
5738
+ for ( i = column + 1; i < c.columns; i++ ) {
5739
+ len += c.$headerIndexed[i].is( ':visible' ) ? 1 : 0;
5740
+ }
5741
+ return len === 0;
5742
+ },
5743
+
5734
5744
  // prevent text selection while dragging resize bar
5735
5745
  toggleTextSelection : function( c, wo, toggle ) {
5736
5746
  var namespace = c.namespace + 'tsresize';
@@ -1,4 +1,4 @@
1
- /*! TableSorter (FORK) v2.29.0 *//*
1
+ /*! TableSorter (FORK) v2.29.2 *//*
2
2
  * Client-side table sorting with ease!
3
3
  * @requires jQuery v1.2.6+
4
4
  *
@@ -22,7 +22,7 @@
22
22
  'use strict';
23
23
  var ts = $.tablesorter = {
24
24
 
25
- version : '2.29.0',
25
+ version : '2.29.2',
26
26
 
27
27
  parsers : [],
28
28
  widgets : [],
@@ -514,8 +514,7 @@
514
514
  if ( c.delayInit && ts.isEmptyObject( c.cache ) ) {
515
515
  ts.buildCache( c );
516
516
  }
517
- // jQuery v1.2.6 doesn't have closest()
518
- $cell = ts.getHeaderCell( $( this ) );
517
+ $cell = ts.getClosest( $( this ), '.' + ts.css.header );
519
518
  // reference original table headers and find the same cell
520
519
  // don't use $headers or IE8 throws an error - see #987
521
520
  temp = $headers.index( $cell );
@@ -555,10 +554,15 @@
555
554
  '';
556
555
  // redefine c.$headers here in case of an updateAll that replaces or adds an entire header cell - see #683
557
556
  c.$headers = $( $.map( c.$table.find( c.selectorHeaders ), function( elem, index ) {
558
- var configHeaders, header, column, template, tmp, $th,
557
+ var configHeaders, header, column, template, tmp,
559
558
  $elem = $( elem );
560
559
  // ignore cell (don't add it to c.$headers) if row has ignoreRow class
561
- if ( $elem.parent().hasClass( c.cssIgnoreRow ) ) { return; }
560
+ if ( ts.getClosest( $elem, 'tr' ).hasClass( c.cssIgnoreRow ) ) { return; }
561
+ // transfer data-column to element if not th/td - #1459
562
+ if ( !/(th|td)/i.test( elem.nodeName ) ) {
563
+ tmp = ts.getClosest( $elem, 'th, td' );
564
+ $elem.attr( 'data-column', tmp.attr( 'data-column' ) );
565
+ }
562
566
  // make sure to get header cell & not column indexed cell
563
567
  configHeaders = ts.getColumnData( c.table, c.headers, index, true );
564
568
  // save original header content
@@ -581,9 +585,7 @@
581
585
  if ( c.onRenderHeader ) {
582
586
  c.onRenderHeader.apply( $elem, [ index, c, c.$table ] );
583
587
  }
584
- // data-column stored on th or td only
585
- $th = ts.getHeaderCell( $elem );
586
- column = parseInt( $th.attr( 'data-column' ), 10 );
588
+ column = parseInt( $elem.attr( 'data-column' ), 10 );
587
589
  elem.column = column;
588
590
  tmp = ts.getOrder( ts.getData( $elem, configHeaders, 'sortInitialOrder' ) || c.sortInitialOrder );
589
591
  // this may get updated numerous times if there are multiple rows
@@ -619,6 +621,7 @@
619
621
  if ( ts.isEmptyObject( c.sortVars[ indx ] ) ) {
620
622
  c.sortVars[ indx ] = {};
621
623
  }
624
+ // Use c.$headers.parent() in case selectorHeaders doesn't point to the th/td
622
625
  $temp = c.$headers.filter( '[data-column="' + indx + '"]' );
623
626
  // target sortable column cells, unless there are none, then use non-sortable cells
624
627
  // .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6
@@ -1082,6 +1085,15 @@
1082
1085
  css = [ ts.css.sortAsc + ' ' + c.cssAsc, ts.css.sortDesc + ' ' + c.cssDesc ],
1083
1086
  cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
1084
1087
  aria = [ 'ascending', 'descending' ],
1088
+ updateColumnSort = function($el, index) {
1089
+ $el
1090
+ .removeClass( none )
1091
+ .addClass( css[ index ] )
1092
+ .attr( 'aria-sort', aria[ index ] )
1093
+ .find( '.' + ts.css.icon )
1094
+ .removeClass( cssIcon[ 2 ] )
1095
+ .addClass( cssIcon[ index ] );
1096
+ },
1085
1097
  // find the footer
1086
1098
  $extras = c.$table
1087
1099
  .find( 'tfoot tr' )
@@ -1120,7 +1132,7 @@
1120
1132
  var include = true,
1121
1133
  $el = c.$headers.eq( i ),
1122
1134
  col = parseInt( $el.attr( 'data-column' ), 10 ),
1123
- end = col + c.$headers[ i ].colSpan;
1135
+ end = col + ts.getClosest( $el, 'th, td' )[0].colSpan;
1124
1136
  for ( ; col < end; col++ ) {
1125
1137
  include = include ? include || ts.isValueInArray( col, c.sortList ) > -1 : false;
1126
1138
  }
@@ -1134,23 +1146,13 @@
1134
1146
  if ( $sorted.length ) {
1135
1147
  for ( column = 0; column < $sorted.length; column++ ) {
1136
1148
  if ( !$sorted[ column ].sortDisabled ) {
1137
- $sorted
1138
- .eq( column )
1139
- .removeClass( none )
1140
- .addClass( css[ list[ indx ][ 1 ] ] )
1141
- .attr( 'aria-sort', aria[ list[ indx ][ 1 ] ] )
1142
- .find( '.' + ts.css.icon )
1143
- .removeClass( cssIcon[ 2 ] )
1144
- .addClass( cssIcon[ list[ indx ][ 1 ] ] );
1149
+ updateColumnSort( $sorted.eq( column ) , list[ indx ][ 1 ] );
1145
1150
  }
1146
1151
  }
1147
- // add sorted class to footer & extra headers, if they exist
1148
- if ( $extras.length ) {
1149
- $extras
1150
- .filter( '[data-column="' + list[ indx ][ 0 ] + '"]' )
1151
- .removeClass( none )
1152
- .addClass( css[ list[ indx ][ 1 ] ] );
1153
- }
1152
+ }
1153
+ // add sorted class to footer & extra headers, if they exist
1154
+ if ( $extras.length ) {
1155
+ updateColumnSort( $extras.filter( '[data-column="' + list[ indx ][ 0 ] + '"]' ), list[ indx ][ 1 ] );
1154
1156
  }
1155
1157
  }
1156
1158
  }
@@ -1161,29 +1163,20 @@
1161
1163
  }
1162
1164
  },
1163
1165
 
1164
- // This function does NOT return closest if the $el matches the selector
1165
1166
  getClosest : function( $el, selector ) {
1166
- return $.fn.closest ?
1167
- $el.closest( selector ) :
1168
- $el.parents( selector ).filter( ':first' );
1169
- },
1170
-
1171
- getHeaderCell : function( $el ) {
1172
1167
  // jQuery v1.2.6 doesn't have closest()
1173
1168
  if ( $.fn.closest ) {
1174
- return $el.closest( 'th, td' );
1169
+ return $el.closest( selector );
1175
1170
  }
1176
- return /TH|TD/.test( $el[0].nodeName ) ?
1171
+ return $el.is( selector ) ?
1177
1172
  $el :
1178
- $el.parents( 'th, td' ).filter( ':first' );
1173
+ $el.parents( selector ).filter( ':first' );
1179
1174
  },
1180
1175
 
1181
1176
  // nextSort (optional), lets you disable next sort text
1182
1177
  setColumnAriaLabel : function( c, $header, nextSort ) {
1183
1178
  if ( $header.length ) {
1184
- var $th = ts.getHeaderCell( $header ),
1185
- // data-column always stored on the th/td
1186
- column = parseInt( $th.attr( 'data-column' ), 10 ),
1179
+ var column = parseInt( $header.attr( 'data-column' ), 10 ),
1187
1180
  vars = c.sortVars[ column ],
1188
1181
  tmp = $header.hasClass( ts.css.sortAsc ) ?
1189
1182
  'sortAsc' :
@@ -1551,10 +1544,10 @@
1551
1544
  notMultiSort = !event[ c.sortMultiSortKey ],
1552
1545
  table = c.table,
1553
1546
  len = c.$headers.length,
1554
- // get current column index; *always* stored on th/td
1555
- $th = ts.getHeaderCell( $( cell ) ),
1556
- col = parseInt( $th.attr( 'data-column' ), 10 ),
1547
+ th = ts.getClosest( $( cell ), 'th, td' ),
1548
+ col = parseInt( th.attr( 'data-column' ), 10 ),
1557
1549
  order = c.sortVars[ col ].order;
1550
+ th = th[0];
1558
1551
  // Only call sortStart if sorting is enabled
1559
1552
  c.$table.triggerHandler( 'sortStart', table );
1560
1553
  // get current column sort order
@@ -1589,8 +1582,8 @@
1589
1582
  if ( dir < 2 ) {
1590
1583
  c.sortList[ c.sortList.length ] = [ col, dir ];
1591
1584
  // add other columns if header spans across multiple
1592
- if ( cell.colSpan > 1 ) {
1593
- for ( indx = 1; indx < cell.colSpan; indx++ ) {
1585
+ if ( th.colSpan > 1 ) {
1586
+ for ( indx = 1; indx < th.colSpan; indx++ ) {
1594
1587
  c.sortList[ c.sortList.length ] = [ col + indx, dir ];
1595
1588
  // update count on columns in colSpan
1596
1589
  c.sortVars[ col + indx ].count = $.inArray( dir, order );
@@ -1622,8 +1615,8 @@
1622
1615
  if ( dir < 2 ) {
1623
1616
  c.sortList[ c.sortList.length ] = [ col, dir ];
1624
1617
  // add other columns if header spans across multiple
1625
- if ( cell.colSpan > 1 ) {
1626
- for ( indx = 1; indx < cell.colSpan; indx++ ) {
1618
+ if ( th.colSpan > 1 ) {
1619
+ for ( indx = 1; indx < th.colSpan; indx++ ) {
1627
1620
  c.sortList[ c.sortList.length ] = [ col + indx, dir ];
1628
1621
  // update count on columns in colSpan
1629
1622
  c.sortVars[ col + indx ].count = $.inArray( dir, order );
@@ -2392,7 +2385,7 @@
2392
2385
  $cells = ( $headers || c.$headers ),
2393
2386
  // c.$headerIndexed is not defined initially
2394
2387
  $cell = c.$headerIndexed && c.$headerIndexed[ indx ] ||
2395
- $cells.filter( '[data-column="' + indx + '"]:last' );
2388
+ $cells.find( '[data-column="' + indx + '"]:last' );
2396
2389
  if ( typeof obj[ indx ] !== 'undefined' ) {
2397
2390
  return getCell ? obj[ indx ] : obj[ $cells.index( $cell ) ];
2398
2391
  }
@@ -4,7 +4,7 @@
4
4
  ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
5
5
  █████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
6
6
  */
7
- /*! tablesorter (FORK) - updated 09-27-2017 (v2.29.0)*/
7
+ /*! tablesorter (FORK) - updated 12-13-2017 (v2.29.2)*/
8
8
  /* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
9
9
  (function(factory) {
10
10
  if (typeof define === 'function' && define.amd) {
@@ -408,7 +408,7 @@
408
408
 
409
409
  })(jQuery);
410
410
 
411
- /*! Widget: filter - updated 7/4/2017 (v2.28.15) *//*
411
+ /*! Widget: filter - updated 12/13/2017 (v2.29.1) *//*
412
412
  * Requires tablesorter v2.8+ and jQuery 1.7+
413
413
  * by Rob Garrison
414
414
  */
@@ -1525,6 +1525,7 @@
1525
1525
  if ( $.inArray( ffxn, vars.excludeMatch ) < 0 && matches === null ) {
1526
1526
  matches = tsf.types[ffxn]( c, data, vars );
1527
1527
  if ( matches !== null ) {
1528
+ data.matchedOn = ffxn;
1528
1529
  filterMatched = matches;
1529
1530
  }
1530
1531
  }
@@ -1572,6 +1573,7 @@
1572
1573
  tsf.multipleColumns( c, wo.filter_$anyMatch ) :
1573
1574
  [];
1574
1575
  data.$cells = data.$row.children();
1576
+ data.matchedOn = null;
1575
1577
  if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
1576
1578
  data.anyMatch = true;
1577
1579
  data.isMatch = true;
@@ -1673,7 +1675,9 @@
1673
1675
  // cycle through the different filters
1674
1676
  // filters return a boolean or null if nothing matches
1675
1677
  filterMatched = tsf.processTypes( c, data, vars );
1676
- if ( filterMatched !== null ) {
1678
+ // select with exact match; ignore "and" or "or" within the text; fixes #1486
1679
+ txt = fxn === true && (data.matchedOn === 'and' || data.matchedOn === 'or');
1680
+ if ( filterMatched !== null && !txt) {
1677
1681
  result = filterMatched;
1678
1682
  // Look for match, and add child row data for matching
1679
1683
  } else {
@@ -2655,7 +2659,7 @@
2655
2659
 
2656
2660
  })(jQuery, window);
2657
2661
 
2658
- /*! Widget: resizable - updated 9/27/2017 (v2.29.0) */
2662
+ /*! Widget: resizable - updated 12/13/2017 (v2.29.1) */
2659
2663
  /*jshint browser:true, jquery:true, unused:false */
2660
2664
  ;(function ($, window) {
2661
2665
  'use strict';
@@ -2832,7 +2836,10 @@
2832
2836
  columns = c.columns - 1,
2833
2837
  $header = $this.data( 'header' );
2834
2838
  if ( !$header ) { return; } // see #859
2835
- if ( !$header.is(':visible') ) {
2839
+ if (
2840
+ !$header.is(':visible') ||
2841
+ ( !wo.resizable_addLastColumn && ts.resizable.checkVisibleColumns(c, column) )
2842
+ ) {
2836
2843
  $this.hide();
2837
2844
  } else if ( column < columns || column === columns && wo.resizable_addLastColumn ) {
2838
2845
  $this.css({
@@ -2844,6 +2851,16 @@
2844
2851
  });
2845
2852
  },
2846
2853
 
2854
+ // Fixes #1485
2855
+ checkVisibleColumns: function( c, column ) {
2856
+ var i,
2857
+ len = 0;
2858
+ for ( i = column + 1; i < c.columns; i++ ) {
2859
+ len += c.$headerIndexed[i].is( ':visible' ) ? 1 : 0;
2860
+ }
2861
+ return len === 0;
2862
+ },
2863
+
2847
2864
  // prevent text selection while dragging resize bar
2848
2865
  toggleTextSelection : function( c, wo, toggle ) {
2849
2866
  var namespace = c.namespace + 'tsresize';
@@ -1,4 +1,4 @@
1
- /*! Widget: filter - updated 7/4/2017 (v2.28.15) *//*
1
+ /*! Widget: filter - updated 12/13/2017 (v2.29.1) *//*
2
2
  * Requires tablesorter v2.8+ and jQuery 1.7+
3
3
  * by Rob Garrison
4
4
  */
@@ -1115,6 +1115,7 @@
1115
1115
  if ( $.inArray( ffxn, vars.excludeMatch ) < 0 && matches === null ) {
1116
1116
  matches = tsf.types[ffxn]( c, data, vars );
1117
1117
  if ( matches !== null ) {
1118
+ data.matchedOn = ffxn;
1118
1119
  filterMatched = matches;
1119
1120
  }
1120
1121
  }
@@ -1162,6 +1163,7 @@
1162
1163
  tsf.multipleColumns( c, wo.filter_$anyMatch ) :
1163
1164
  [];
1164
1165
  data.$cells = data.$row.children();
1166
+ data.matchedOn = null;
1165
1167
  if ( data.anyMatchFlag && columnIndex.length > 1 || ( data.anyMatchFilter && !hasAnyMatchInput ) ) {
1166
1168
  data.anyMatch = true;
1167
1169
  data.isMatch = true;
@@ -1263,7 +1265,9 @@
1263
1265
  // cycle through the different filters
1264
1266
  // filters return a boolean or null if nothing matches
1265
1267
  filterMatched = tsf.processTypes( c, data, vars );
1266
- if ( filterMatched !== null ) {
1268
+ // select with exact match; ignore "and" or "or" within the text; fixes #1486
1269
+ txt = fxn === true && (data.matchedOn === 'and' || data.matchedOn === 'or');
1270
+ if ( filterMatched !== null && !txt) {
1267
1271
  result = filterMatched;
1268
1272
  // Look for match, and add child row data for matching
1269
1273
  } else {
@@ -1,4 +1,4 @@
1
- /*! Widget: resizable - updated 9/27/2017 (v2.29.0) */
1
+ /*! Widget: resizable - updated 12/13/2017 (v2.29.1) */
2
2
  /*jshint browser:true, jquery:true, unused:false */
3
3
  ;(function ($, window) {
4
4
  'use strict';
@@ -175,7 +175,10 @@
175
175
  columns = c.columns - 1,
176
176
  $header = $this.data( 'header' );
177
177
  if ( !$header ) { return; } // see #859
178
- if ( !$header.is(':visible') ) {
178
+ if (
179
+ !$header.is(':visible') ||
180
+ ( !wo.resizable_addLastColumn && ts.resizable.checkVisibleColumns(c, column) )
181
+ ) {
179
182
  $this.hide();
180
183
  } else if ( column < columns || column === columns && wo.resizable_addLastColumn ) {
181
184
  $this.css({
@@ -187,6 +190,16 @@
187
190
  });
188
191
  },
189
192
 
193
+ // Fixes #1485
194
+ checkVisibleColumns: function( c, column ) {
195
+ var i,
196
+ len = 0;
197
+ for ( i = column + 1; i < c.columns; i++ ) {
198
+ len += c.$headerIndexed[i].is( ':visible' ) ? 1 : 0;
199
+ }
200
+ return len === 0;
201
+ },
202
+
190
203
  // prevent text selection while dragging resize bar
191
204
  toggleTextSelection : function( c, wo, toggle ) {
192
205
  var namespace = c.namespace + 'tsresize';
@@ -1,4 +1,4 @@
1
- /*! Widget: scroller - updated 9/27/2017 (v2.29.0) *//*
1
+ /*! Widget: scroller - updated 12/13/2017 (v2.29.1) *//*
2
2
  Copyright (C) 2011 T. Connell & Associates, Inc.
3
3
 
4
4
  Dual-licensed under the MIT and GPL licenses
@@ -289,8 +289,10 @@
289
289
  });
290
290
 
291
291
  // resize/update events - filterEnd fires after "tablesorter-initialized" and "updateComplete"
292
- events = ( ( ts.hasWidget( c.table, 'filter' ) ? 'filterEnd' : 'tablesorter-initialized updateComplete' ) +
293
- ' sortEnd pagerComplete columnUpdate ' ).split( ' ' ).join( namespace + ' ' );
292
+ tmp = ts.hasWidget( c.table, 'filter' ) ?
293
+ 'filterEnd filterInit' :
294
+ 'tablesorter-initialized updateComplete';
295
+ events = ( tmp + ' sortEnd pagerComplete columnUpdate ' ).split( ' ' ).join( namespace + ' ' );
294
296
 
295
297
  $table
296
298
  .off( namespace )
@@ -0,0 +1,137 @@
1
+ /*! Widget: vertical-group (BETA) - updated 12/13/2017 (v2.29.1) */
2
+ /* Requires tablesorter and jQuery
3
+ * Originally by @aavmurphy (Andrew Murphy)
4
+ * Adapted for tablesorter by Rob Garrison - see #1469 & #1470
5
+ *
6
+ * This widget is licensed under the same terms at mottie/tablesorter itself, i.e. free to use
7
+ */
8
+ /* jshint browser:true, jquery:true, unused:false */
9
+ /* global jQuery:false */
10
+ ;(function($){
11
+ 'use strict';
12
+
13
+ var ts = $.tablesorter,
14
+ tscss = ts.css;
15
+
16
+ $.extend( ts.css, {
17
+ verticalGroupHeader: 'tablesorter-vertical-group',
18
+ verticalGroupHide: 'tablesorter-vertical-group-hide',
19
+ verticalGroupShow: 'tablesorter-vertical-group-show'
20
+ });
21
+
22
+ ts.addWidget({
23
+ id: 'vertical-group',
24
+ priority: 99,
25
+ init: verticalGroup,
26
+ format: verticalGroup
27
+ });
28
+
29
+ function cleanUp( el ) {
30
+ el.removeClass(tscss.verticalGroupHide + ' ' + tscss.verticalGroupShow);
31
+ }
32
+
33
+ function setZebra( wo, $cell, indx ) {
34
+ var $row = $cell.parent();
35
+ $row
36
+ .removeClass( wo.zebra[ (indx + 1) % 2 ] )
37
+ .addClass( wo.zebra[ indx % 2] );
38
+ }
39
+
40
+ function verticalGroup( table, c, wo, init ) {
41
+ // -------------------------------------------------------------------------
42
+ // loop thru the header row,
43
+ // - look for .vertical-group
44
+ //
45
+ // loop thru the rows
46
+ //
47
+ // set ALWAYS_SHOW = FALSE
48
+ // loop thru the 1st 4 columns
49
+ // if this cell does not exist, skip to next row
50
+ // if ALWAYS_SHOW, then this cell is SHOW
51
+ // else if this column does not have '.vertical-group', then this cell is SHOW
52
+ // else if this cell is NOT the same as the cell-above, then this cell is SHOW
53
+ // else this cell is HIDE
54
+ // if this cell is SHOW, set ALWAYS_SHOW
55
+ // if this cell is SHOW,
56
+ // then
57
+ // set the cell class to .vertical_group_show
58
+ // else
59
+ // set the cell class to vertical_group_show
60
+ //
61
+ // TO DO add/remove classes so as not to clobber other existing classes
62
+ // TO DO add classes
63
+ //
64
+ // .vertical-group-show { background-color: white !important; }
65
+ // .vertical-group-hide { visibility: hidden; border-top: white !important;background-color: white !important; }
66
+ //
67
+ // this is all because of stripped tables
68
+ // - background-colour show be the table's background colour (or the first row's)
69
+ // - the border-color needs to be the same
70
+ //
71
+ // ------------------------------------------------------------------------------------------------
72
+ var tmp,
73
+ zebra_index = -1, // increments at start of loop
74
+ rows = table.tBodies[0].rows,
75
+ header = table.tHead.rows,
76
+ has_zebra = ts.hasWidget( table, 'zebra'),
77
+ is_vertical_group_col = [],
78
+ last_row = [];
79
+
80
+ if ( wo.vertical_group_lock ) {
81
+ return;
82
+ }
83
+ wo.vertical_group_lock = true;
84
+
85
+ is_vertical_group_col = $.map( c.$headerIndexed, function( el ) {
86
+ return el.hasClass( tscss.verticalGroupHeader ) ? 1 : '';
87
+ });
88
+
89
+ if ( is_vertical_group_col.join('') === '' ) {
90
+ cleanUp( $(rows).find( '.' + tscss.verticalGroupHide + ',.' + tscss.verticalGroupShow ) );
91
+ wo.vertical_group_lock = false;
92
+ return;
93
+ }
94
+
95
+ for (var i = 0; i < rows.length; i++) {
96
+ var always_show_cell = false;
97
+
98
+ for (var j = 0; j < c.columns; j++ ) {
99
+ if ( !is_vertical_group_col[ j ] || !rows[ i ].cells[ j ] ) {
100
+ zebra_index++;
101
+ continue;
102
+ }
103
+
104
+ var $cell = $( rows[ i ].cells[ j ] ),
105
+ // only group if column is sorted
106
+ isSorted = ts.isValueInArray( j, c.sortList ), // returns equivalent of an indexOf value
107
+ cell_data = $cell.html();
108
+
109
+ if ( isSorted < 0 ) {
110
+ cleanUp( $cell );
111
+ } else if ( !always_show_cell && cell_data === last_row[j] ) {
112
+ if ( !$cell.hasClass(tscss.verticalGroupHide) ) {
113
+ $cell.addClass( tscss.verticalGroupHide );
114
+ }
115
+ if ( has_zebra ) {
116
+ setZebra( wo, $cell, zebra_index );
117
+ }
118
+ $cell.removeClass( tscss.verticalGroupShow );
119
+ } else if (isSorted === 0) {
120
+ // only show cells from the first sorted column
121
+ always_show_cell = true; // show
122
+ if ( !$cell.hasClass( tscss.verticalGroupShow ) ) {
123
+ $cell.addClass( tscss.verticalGroupShow );
124
+ }
125
+ $cell.removeClass( tscss.verticalGroupHide );
126
+ if ( has_zebra ) {
127
+ // only adjust striping based on the first sorted column
128
+ setZebra( wo, $cell, isSorted ? zebra_index : ++zebra_index );
129
+ }
130
+ }
131
+ last_row[j] = cell_data;
132
+ }
133
+ }
134
+ wo.vertical_group_lock = false;
135
+ }
136
+
137
+ })(jQuery);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-tablesorter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.24.0
4
+ version: 1.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jun Lin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-09 00:00:00.000000000 Z
12
+ date: 2017-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -142,6 +142,7 @@ files:
142
142
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-storage.js
143
143
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-toggle.js
144
144
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-uitheme.js
145
+ - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-vertical-group.js
145
146
  - vendor/assets/javascripts/jquery-tablesorter/widgets/widget-view.js
146
147
  - vendor/assets/stylesheets/jquery-tablesorter/addons/pager/jquery.tablesorter.pager.css
147
148
  - vendor/assets/stylesheets/jquery-tablesorter/dragtable.mod.css