datatables.net 2.1.2 → 2.1.4

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.
package/js/dataTables.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.1.2
1
+ /*! DataTables 2.1.4
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -1217,7 +1217,7 @@ var _removeEmpty = function ( a )
1217
1217
 
1218
1218
  // Replaceable function in api.util
1219
1219
  var _stripHtml = function (input) {
1220
- if (! input) {
1220
+ if (! input || typeof input !== 'string') {
1221
1221
  return input;
1222
1222
  }
1223
1223
 
@@ -4678,7 +4678,7 @@ function _fnFilterData ( settings )
4678
4678
  */
4679
4679
  function _fnInitialise ( settings )
4680
4680
  {
4681
- var i, iAjaxStart=settings.iInitDisplayStart;
4681
+ var i;
4682
4682
  var init = settings.oInit;
4683
4683
  var deferLoading = settings.deferLoading;
4684
4684
  var dataSrc = _fnDataSource( settings );
@@ -4699,6 +4699,9 @@ function _fnInitialise ( settings )
4699
4699
  _fnDrawHead( settings, settings.aoHeader );
4700
4700
  _fnDrawHead( settings, settings.aoFooter );
4701
4701
 
4702
+ // Cache the paging start point, as the first redraw will reset it
4703
+ var iAjaxStart = settings.iInitDisplayStart
4704
+
4702
4705
  // Local data load
4703
4706
  // Check if there is data passing into the constructor
4704
4707
  if ( init.aaData ) {
@@ -4913,6 +4916,11 @@ function _processingHtml ( settings )
4913
4916
  */
4914
4917
  function _fnProcessingDisplay ( settings, show )
4915
4918
  {
4919
+ // Ignore cases when we are still redrawing
4920
+ if (settings.bDrawing && show === false) {
4921
+ return;
4922
+ }
4923
+
4916
4924
  _fnCallbackFire( settings, null, 'processing', [settings, show] );
4917
4925
  }
4918
4926
 
@@ -6169,8 +6177,7 @@ function _fnImplementState ( settings, s, callback) {
6169
6177
  }
6170
6178
  }
6171
6179
 
6172
- // Restore key features - todo - for 1.11 this needs to be done by
6173
- // subscribed events
6180
+ // Restore key features
6174
6181
  if ( s.start !== undefined ) {
6175
6182
  if(api === null) {
6176
6183
  settings._iDisplayStart = s.start;
@@ -8422,8 +8429,10 @@ var __column_selector = function ( settings, selector, opts )
8422
8429
  switch( match[2] ) {
8423
8430
  case 'visIdx':
8424
8431
  case 'visible':
8425
- if (match[1]) {
8432
+ // Selector is a column index
8433
+ if (match[1] && match[1].match(/^\d+$/)) {
8426
8434
  var idx = parseInt( match[1], 10 );
8435
+
8427
8436
  // Visible index given, convert to column index
8428
8437
  if ( idx < 0 ) {
8429
8438
  // Counting from the right
@@ -8436,9 +8445,19 @@ var __column_selector = function ( settings, selector, opts )
8436
8445
  return [ _fnVisibleToColumnIndex( settings, idx ) ];
8437
8446
  }
8438
8447
 
8439
- // `:visible` on its own
8440
- return columns.map( function (col, i) {
8441
- return col.bVisible ? i : null;
8448
+ return columns.map( function (col, idx) {
8449
+ // Not visible, can't match
8450
+ if (! col.bVisible) {
8451
+ return null;
8452
+ }
8453
+
8454
+ // Selector
8455
+ if (match[1]) {
8456
+ return $(nodes[idx]).filter(match[1]).length > 0 ? idx : null;
8457
+ }
8458
+
8459
+ // `:visible` on its own
8460
+ return idx;
8442
8461
  } );
8443
8462
 
8444
8463
  case 'name':
@@ -9751,7 +9770,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9751
9770
  * @type string
9752
9771
  * @default Version number
9753
9772
  */
9754
- DataTable.version = "2.1.2";
9773
+ DataTable.version = "2.1.4";
9755
9774
 
9756
9775
  /**
9757
9776
  * Private data store, containing all of the settings objects that are
@@ -12425,7 +12444,7 @@ DataTable.type('string', {
12425
12444
  pre: function ( a ) {
12426
12445
  // This is a little complex, but faster than always calling toString,
12427
12446
  // http://jsperf.com/tostring-v-check
12428
- return _empty(a) ?
12447
+ return _empty(a) && typeof a !== 'boolean' ?
12429
12448
  '' :
12430
12449
  typeof a === 'string' ?
12431
12450
  a.toLowerCase() :
@@ -12678,6 +12697,12 @@ $.extend( true, DataTable.ext.renderer, {
12678
12697
  return; // table, not a nested one
12679
12698
  }
12680
12699
 
12700
+ var sorting = ctx.sortDetails;
12701
+
12702
+ if (! sorting) {
12703
+ return;
12704
+ }
12705
+
12681
12706
  var i;
12682
12707
  var orderClasses = classes.order;
12683
12708
  var columns = ctx.api.columns( cell );
@@ -12686,7 +12711,6 @@ $.extend( true, DataTable.ext.renderer, {
12686
12711
  var ariaType = '';
12687
12712
  var indexes = columns.indexes();
12688
12713
  var sortDirs = columns.orderable(true).flatten();
12689
- var sorting = ctx.sortDetails;
12690
12714
  var orderedColumns = _pluck(sorting, 'col');
12691
12715
 
12692
12716
  cell
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "js/dataTables.js",
5
5
  "module": "js/dataTables.mjs",
6
6
  "types": "./types/types.d.ts",
7
- "version": "2.1.2",
7
+ "version": "2.1.4",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -2759,13 +2759,13 @@ export interface DataTablesStatic {
2759
2759
  *
2760
2760
  * @param type The library needed
2761
2761
  */
2762
- use(type: 'lib' | 'win' | 'datetime' | 'luxon' | 'moment');
2762
+ use(type: 'lib' | 'win' | 'datetime' | 'luxon' | 'moment'): any;
2763
2763
 
2764
2764
  /**
2765
2765
  * Set the libraries that DataTables uses, or the global objects, with automatic
2766
2766
  * detection of what the library is. Used for module loading environments.
2767
2767
  */
2768
- use(library: any);
2768
+ use(library: any): void;
2769
2769
 
2770
2770
  /**
2771
2771
  * Set the libraries that DataTables uses, or the global objects, explicity staing
@@ -2774,7 +2774,7 @@ export interface DataTablesStatic {
2774
2774
  * @param type Indicate the library that is being loaded.
2775
2775
  * @param library The library (e.g. Moment or Luxon)
2776
2776
  */
2777
- use(type: 'lib' | 'win' | 'datetime' | 'luxon' | 'moment', library: any);
2777
+ use(type: 'lib' | 'win' | 'datetime' | 'luxon' | 'moment', library: any): void;
2778
2778
 
2779
2779
  /**
2780
2780
  * Utils