datatables.net 2.0.5 → 2.0.6

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.0.5
1
+ /*! DataTables 2.0.6
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -4369,6 +4369,7 @@ function _fnFilter( searchRows, settings, input, options, column )
4369
4369
  }
4370
4370
 
4371
4371
  var i = 0;
4372
+ var matched = [];
4372
4373
 
4373
4374
  // Search term can be a function, regex or string - if a string we apply our
4374
4375
  // smart filtering regex (assuming the options require that)
@@ -4380,18 +4381,22 @@ function _fnFilter( searchRows, settings, input, options, column )
4380
4381
  : _fnFilterCreateSearch( input, options );
4381
4382
 
4382
4383
  // Then for each row, does the test pass. If not, lop the row from the array
4383
- while (i < searchRows.length) {
4384
+ for (i=0 ; i<searchRows.length ; i++) {
4384
4385
  var row = settings.aoData[ searchRows[i] ];
4385
4386
  var data = column === undefined
4386
4387
  ? row._sFilterRow
4387
4388
  : row._aFilterData[ column ];
4388
4389
 
4389
- if ( (searchFunc && ! searchFunc(data, row._aData, searchRows[i], column)) || (rpSearch && ! rpSearch.test(data)) ) {
4390
- searchRows.splice(i, 1);
4391
- i--;
4390
+ if ( (searchFunc && searchFunc(data, row._aData, searchRows[i], column)) || (rpSearch && rpSearch.test(data)) ) {
4391
+ matched.push(searchRows[i]);
4392
4392
  }
4393
+ }
4393
4394
 
4394
- i++;
4395
+ // Mutate the searchRows array
4396
+ searchRows.length = matched.length;
4397
+
4398
+ for (i=0 ; i<matched.length ; i++) {
4399
+ searchRows[i] = matched[i];
4395
4400
  }
4396
4401
  }
4397
4402
 
@@ -4759,6 +4764,7 @@ function _fnPageChange ( settings, action, redraw )
4759
4764
  function _processingHtml ( settings )
4760
4765
  {
4761
4766
  var table = settings.nTable;
4767
+ var scrolling = settings.oScroll.sX !== '' || settings.oScroll.sY !== '';
4762
4768
 
4763
4769
  if ( settings.oFeatures.bProcessing ) {
4764
4770
  var n = $('<div/>', {
@@ -4767,9 +4773,16 @@ function _processingHtml ( settings )
4767
4773
  'role': 'status'
4768
4774
  } )
4769
4775
  .html( settings.oLanguage.sProcessing )
4770
- .append('<div><div></div><div></div><div></div><div></div></div>')
4771
- .insertBefore( table );
4772
-
4776
+ .append('<div><div></div><div></div><div></div><div></div></div>');
4777
+
4778
+ // Different positioning depending on if scrolling is enabled or not
4779
+ if (scrolling) {
4780
+ n.prependTo( 'div.dt-scroll', settings.nTableWrapper );
4781
+ }
4782
+ else {
4783
+ n.insertBefore( table );
4784
+ }
4785
+
4773
4786
  $(table).on( 'processing.dt.DT', function (e, s, show) {
4774
4787
  n.css( 'display', show ? 'block' : 'none' );
4775
4788
  } );
@@ -5013,7 +5026,7 @@ function _fnScrollDraw ( settings )
5013
5026
  // of the indexes out.
5014
5027
  if (settings.aiDisplay.length) {
5015
5028
  // Get the column sizes from the first row in the table
5016
- var colSizes = table.find('tbody tr').eq(0).find('th, td').map(function (vis) {
5029
+ var colSizes = table.children('tbody > tr').eq(0).children('th, td').map(function (vis) {
5017
5030
  return {
5018
5031
  idx: _fnVisibleToColumnIndex(settings, vis),
5019
5032
  width: $(this).outerWidth()
@@ -5457,6 +5470,10 @@ function _fnSortAttachListener(settings, node, selector, column, callback) {
5457
5470
  * @param {*} settings
5458
5471
  */
5459
5472
  function _fnSortDisplay(settings, display) {
5473
+ if (display.length < 2) {
5474
+ return;
5475
+ }
5476
+
5460
5477
  var master = settings.aiDisplayMaster;
5461
5478
  var masterMap = {};
5462
5479
  var map = {};
@@ -7848,9 +7865,15 @@ _api_register( 'row().data()', function ( data ) {
7848
7865
  _api_register( 'row().node()', function () {
7849
7866
  var ctx = this.context;
7850
7867
 
7851
- return ctx.length && this.length && this[0].length ?
7852
- ctx[0].aoData[ this[0] ].nTr || null :
7853
- null;
7868
+ if (ctx.length && this.length && this[0].length) {
7869
+ var row = ctx[0].aoData[ this[0] ];
7870
+
7871
+ if (row && row.nTr) {
7872
+ return row.nTr;
7873
+ }
7874
+ }
7875
+
7876
+ return null;
7854
7877
  } );
7855
7878
 
7856
7879
 
@@ -7909,8 +7932,9 @@ var __details_state_load = function (api, state)
7909
7932
  if ( state && state.childRows ) {
7910
7933
  api
7911
7934
  .rows( state.childRows.map(function (id) {
7912
- // Escape any `:` characters from the row id, unless previously escaped
7913
- return id.replace(/(?<!\\):/g, '\\:');
7935
+ // Escape any `:` characters from the row id. Accounts for
7936
+ // already escaped characters.
7937
+ return id.replace(/([^:\\]*(?:\\.[^:\\]*)*):/g, "$1\\:");
7914
7938
  }) )
7915
7939
  .every( function () {
7916
7940
  _fnCallbackFire( api.settings()[0], null, 'requestChild', [ this ] )
@@ -9534,7 +9558,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
9534
9558
  * @type string
9535
9559
  * @default Version number
9536
9560
  */
9537
- DataTable.version = "2.0.5";
9561
+ DataTable.version = "2.0.6";
9538
9562
 
9539
9563
  /**
9540
9564
  * Private data store, containing all of the settings objects that are
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.0.5",
7
+ "version": "2.0.6",
8
8
  "files": [
9
9
  "js/**/*.js",
10
10
  "js/**/*.mjs",
package/types/types.d.ts CHANGED
@@ -157,11 +157,20 @@ export interface Feature {
157
157
 
158
158
  /** Pagination buttons */
159
159
  paging?: {
160
+ /** Set the maximum number of paging number buttons */
161
+ buttons?: number;
162
+
160
163
  /** Paging button display options */
161
164
  type?: 'numbers' | 'simple' | 'simple_numbers' | 'full' | 'full_numbers' | 'first_last_numbers';
162
165
 
163
- /** Set the maximum number of paging number buttons */
166
+ /**
167
+ * Set the maximum number of paging number buttons
168
+ * @deprecated Use `buttons` instead.
169
+ */
164
170
  numbers?: number;
171
+
172
+ /** Include the extreme page numbers, if separated by ellipsis, or not */
173
+ boundaryNumbers?: boolean;
165
174
  }
166
175
 
167
176
  /** Global search input */
@@ -182,7 +191,7 @@ type LayoutEdge = 'Start' | 'End';
182
191
 
183
192
  type LayoutKeys = `${LayoutSide}${LayoutNumber}${LayoutEdge}` | `${LayoutSide}${LayoutNumber}`;
184
193
 
185
- type Layout = Partial<Record<LayoutKeys, keyof Feature | Feature | Array<keyof Feature> | Feature[]>>;
194
+ type Layout = Partial<Record<LayoutKeys, keyof Feature | Feature | Array<keyof Feature> | Feature[] | null>>;
186
195
 
187
196
 
188
197
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *