jquery-datatables-rails 1.12.2 → 2.1.10.0.0

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/dataTables/extras/filler.png +0 -0
  3. data/app/assets/images/dataTables/extras/loading-background.png +0 -0
  4. data/app/assets/images/dataTables/sort_asc_disabled.png +0 -0
  5. data/app/assets/javascripts/dataTables/extras/dataTables.autoFill.js +851 -0
  6. data/app/assets/javascripts/dataTables/extras/{ColReorder.js → dataTables.colReorder.js} +558 -223
  7. data/app/assets/javascripts/dataTables/extras/dataTables.colVis.js +1096 -0
  8. data/app/assets/javascripts/dataTables/extras/{FixedColumns.js → dataTables.fixedColumns.js} +163 -113
  9. data/app/assets/javascripts/dataTables/extras/{FixedHeader.js → dataTables.fixedHeader.js} +306 -219
  10. data/app/assets/javascripts/dataTables/extras/{KeyTable.js → dataTables.keyTable.js} +155 -95
  11. data/app/assets/javascripts/dataTables/extras/{Scroller.js → dataTables.scroller.js} +469 -188
  12. data/app/assets/javascripts/dataTables/extras/{TableTools.js → dataTables.tableTools.js} +949 -341
  13. data/app/assets/javascripts/dataTables/jquery.dataTables.foundation.js +4 -4
  14. data/app/assets/javascripts/dataTables/jquery.dataTables.js +10711 -8427
  15. data/app/assets/media/dataTables/extras/swf/copy_csv_xls.swf +0 -0
  16. data/app/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf +0 -0
  17. data/app/assets/stylesheets/dataTables/extras/dataTables.autoFill.css.scss +24 -0
  18. data/app/assets/stylesheets/dataTables/extras/dataTables.colReorder.css.scss +14 -0
  19. data/app/assets/stylesheets/dataTables/extras/dataTables.colVis.css.scss +184 -0
  20. data/app/assets/stylesheets/dataTables/extras/dataTables.colvis.jqueryui.css.scss +23 -0
  21. data/app/assets/stylesheets/dataTables/extras/dataTables.fixedColumns.css.scss +24 -0
  22. data/app/assets/stylesheets/dataTables/extras/dataTables.fixedHeader.css.scss +7 -0
  23. data/app/assets/stylesheets/dataTables/extras/dataTables.keyTable.css.scss +7 -0
  24. data/app/assets/stylesheets/dataTables/extras/dataTables.scroller.css.scss +44 -0
  25. data/app/assets/stylesheets/dataTables/extras/{TableTools.css.erb → dataTables.tableTools.css.scss} +30 -15
  26. data/app/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss +6 -0
  27. data/app/assets/stylesheets/dataTables/jquery.dataTables.css.scss +363 -184
  28. data/app/assets/stylesheets/dataTables/src/jquery.dataTables_themeroller.css +307 -220
  29. data/lib/jquery/datatables/rails/version.rb +1 -1
  30. metadata +42 -22
  31. data/app/assets/javascripts/dataTables/extras/AutoFill.js +0 -820
  32. data/app/assets/javascripts/dataTables/extras/ColVis.js +0 -1005
  33. data/app/assets/javascripts/dataTables/extras/TableTools.min.js +0 -77
  34. data/app/assets/stylesheets/dataTables/extras/ColReorder.css.erb +0 -21
  35. data/app/assets/stylesheets/dataTables/extras/ColVis.css +0 -76
  36. data/app/assets/stylesheets/dataTables/extras/ColVisAlt.css.erb +0 -104
@@ -1,26 +1,37 @@
1
- /*
2
- * File: KeyTable.js
3
- * Version: 1.1.7
4
- * CVS: $Idj$
5
- * Description: Keyboard navigation for HTML tables
6
- * Author: Allan Jardine (www.sprymedia.co.uk)
7
- * Created: Fri Mar 13 21:24:02 GMT 2009
8
- * Modified: $Date$ by $Author$
9
- * Language: Javascript
10
- * License: GPL v2 or BSD 3 point style
11
- * Project: Just a little bit of fun :-)
12
- * Contact: www.sprymedia.co.uk/contact
1
+ /*! KeyTable 1.2.0
2
+ * ©2010-2014 SpryMedia Ltd - datatables.net/license
3
+ */
4
+
5
+ /**
6
+ * @summary KeyTable
7
+ * @description Spreadsheet like keyboard navigation for DataTables
8
+ * @version 1.2.0
9
+ * @file dataTables.keyTable.js
10
+ * @author SpryMedia Ltd (www.sprymedia.co.uk)
11
+ * @contact www.sprymedia.co.uk/contact
12
+ * @copyright Copyright 2009-2014 SpryMedia Ltd.
13
13
  *
14
- * Copyright 2009-2011 Allan Jardine, all rights reserved.
14
+ * This source file is free software, available under the following license:
15
+ * MIT license - http://datatables.net/license/mit
15
16
  *
16
- * This source file is free software, under either the GPL v2 license or a
17
- * BSD style license, available at:
18
- * http://datatables.net/license_gpl2
19
- * http://datatables.net/license_bsd
17
+ * This source file is distributed in the hope that it will be useful, but
18
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
20
+ *
21
+ * For details please refer to: http://www.datatables.net
20
22
  */
21
23
 
24
+ // Global scope for KeyTable for backwards compatibility. Will be removed in 1.3
25
+ var KeyTable;
26
+
27
+
28
+ (function(window, document, undefined) {
29
+
30
+
31
+ var factory = function( $, DataTable ) {
32
+ "use strict";
22
33
 
23
- function KeyTable ( oInit )
34
+ KeyTable = function ( oInit )
24
35
  {
25
36
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
26
37
  * API parameters
@@ -106,6 +117,18 @@ function KeyTable ( oInit )
106
117
  };
107
118
 
108
119
 
120
+ /*
121
+ * Function: fnBlur
122
+ * Purpose: Blur the current focus
123
+ * Returns: -
124
+ * Inputs: -
125
+ */
126
+ this.fnBlur = function()
127
+ {
128
+ _fnBlur();
129
+ };
130
+
131
+
109
132
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
110
133
  * Private parameters
111
134
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@@ -118,8 +141,8 @@ function KeyTable ( oInit )
118
141
  var _nBody = null;
119
142
 
120
143
  /*
121
- * Variable:
122
- * Purpose:
144
+ * Variable:
145
+ * Purpose:
123
146
  * Scope: KeyTable - private
124
147
  */
125
148
  var _nOldFocus = null;
@@ -167,7 +190,8 @@ function KeyTable ( oInit )
167
190
 
168
191
  /*
169
192
  * Variable: _oDatatable
170
- * Purpose: DataTables object for if we are actually using a DataTables table
193
+ * Purpose: DataTables settings object for if we are actually using a
194
+ * DataTables table
171
195
  * Scope: KeyTable - private
172
196
  */
173
197
  var _oDatatable = null;
@@ -208,8 +232,8 @@ function KeyTable ( oInit )
208
232
  */
209
233
  return function ( x, y, z ) {
210
234
  if ( (x===null || typeof x == "number") &&
211
- (y===null || typeof y == "number") &&
212
- typeof z == "function" )
235
+ (y===null || typeof y == "number") &&
236
+ typeof z == "function" )
213
237
  {
214
238
  _fnEventAdd( sKey, x, y, z );
215
239
  }
@@ -250,7 +274,7 @@ function KeyTable ( oInit )
250
274
  */
251
275
  return function ( x, y, z ) {
252
276
  if ( (x===null || typeof arguments[0] == "number") &&
253
- (y===null || typeof arguments[1] == "number" ) )
277
+ (y===null || typeof arguments[1] == "number" ) )
254
278
  {
255
279
  if ( typeof arguments[2] == "function" )
256
280
  {
@@ -328,7 +352,7 @@ function KeyTable ( oInit )
328
352
  if ( typeof fn != 'undefined' )
329
353
  {
330
354
  if ( _oaoEvents[sType][i-iCorrector].x == x &&
331
- _oaoEvents[sType][i-iCorrector].y == y &&
355
+ _oaoEvents[sType][i-iCorrector].y == y &&
332
356
  _oaoEvents[sType][i-iCorrector].fn == fn )
333
357
  {
334
358
  _oaoEvents[sType].splice( i-iCorrector, 1 );
@@ -338,7 +362,7 @@ function KeyTable ( oInit )
338
362
  else
339
363
  {
340
364
  if ( _oaoEvents[sType][i-iCorrector].x == x &&
341
- _oaoEvents[sType][i-iCorrector].y == y )
365
+ _oaoEvents[sType][i-iCorrector].y == y )
342
366
  {
343
367
  _oaoEvents[sType].splice( i, 1 );
344
368
  return 1;
@@ -367,9 +391,9 @@ function KeyTable ( oInit )
367
391
  for ( var i=0 ; i<aEvents.length ; i++ )
368
392
  {
369
393
  if ( (aEvents[i].x == x && aEvents[i].y == y ) ||
370
- (aEvents[i].x === null && aEvents[i].y == y ) ||
371
- (aEvents[i].x == x && aEvents[i].y === null ) ||
372
- (aEvents[i].x === null && aEvents[i].y === null )
394
+ (aEvents[i].x === null && aEvents[i].y == y ) ||
395
+ (aEvents[i].x == x && aEvents[i].y === null ) ||
396
+ (aEvents[i].x === null && aEvents[i].y === null )
373
397
  )
374
398
  {
375
399
  aEvents[i].fn( _fnCellFromCoords(x,y), x, y );
@@ -412,14 +436,14 @@ function KeyTable ( oInit )
412
436
  }
413
437
 
414
438
  /* Add the new class to highlight the focused cell */
415
- jQuery(nTarget).addClass( _sFocusClass );
416
- jQuery(nTarget).parent().addClass( _sFocusClass );
439
+ $(nTarget).addClass( _sFocusClass );
440
+ $(nTarget).parent().addClass( _sFocusClass );
417
441
 
418
442
  /* If it's a DataTable then we need to jump the paging to the relevant page */
419
443
  var oSettings;
420
444
  if ( _oDatatable )
421
445
  {
422
- oSettings = _oDatatable.fnSettings();
446
+ oSettings = _oDatatable;
423
447
  var iRow = _fnFindDtCell( nTarget )[1];
424
448
  var bKeyCaptureCache = _bKeyCapture;
425
449
 
@@ -472,10 +496,10 @@ function KeyTable ( oInit )
472
496
  if ( bAutoScroll )
473
497
  {
474
498
  /* Scroll the viewport such that the new cell is fully visible in the rendered window */
475
- iViewportHeight = document.documentElement.clientHeight;
476
- iViewportWidth = document.documentElement.clientWidth;
477
- iScrollTop = document.body.scrollTop || document.documentElement.scrollTop;
478
- iScrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
499
+ iViewportHeight = $(window).height();
500
+ iViewportWidth = $(window).width();
501
+ iScrollTop = $(document).scrollTop();
502
+ iScrollLeft = $(document).scrollLeft();
479
503
  iHeight = nTarget.offsetHeight;
480
504
  iWidth = nTarget.offsetWidth;
481
505
  aiPos = _fnGetPos( nTarget );
@@ -580,8 +604,8 @@ function KeyTable ( oInit )
580
604
  */
581
605
  function _fnRemoveFocus( nTarget )
582
606
  {
583
- jQuery(nTarget).removeClass( _sFocusClass );
584
- jQuery(nTarget).parent().removeClass( _sFocusClass );
607
+ $(nTarget).removeClass( _sFocusClass );
608
+ $(nTarget).parent().removeClass( _sFocusClass );
585
609
  _fnEventFire( "blur", _iOldX, _iOldY );
586
610
  }
587
611
 
@@ -627,7 +651,7 @@ function KeyTable ( oInit )
627
651
  /* If a modifier key is pressed (exapct shift), ignore the event */
628
652
  if ( e.metaKey || e.altKey || e.ctrlKey )
629
653
  {
630
- return true;
654
+ return true;
631
655
  }
632
656
  var
633
657
  x, y,
@@ -637,13 +661,12 @@ function KeyTable ( oInit )
637
661
  /* Get table height and width - done here so as to be dynamic (if table is updated) */
638
662
  if ( _oDatatable )
639
663
  {
640
- /*
664
+ /*
641
665
  * Locate the current node in the DataTable overriding the old positions - the reason for
642
666
  * is is that there might have been some DataTables interaction between the last focus and
643
667
  * now
644
668
  */
645
- var oSettings = _oDatatable.fnSettings();
646
- iTableHeight = oSettings.aiDisplay.length;
669
+ iTableHeight = _oDatatable.aiDisplay.length;
647
670
 
648
671
  var aDtPos = _fnFindDtCell( _nOldFocus );
649
672
  if ( aDtPos === null )
@@ -665,8 +688,8 @@ function KeyTable ( oInit )
665
688
  switch( iKey )
666
689
  {
667
690
  case 13: /* return */
668
- e.preventDefault();
669
- e.stopPropagation();
691
+ e.preventDefault();
692
+ e.stopPropagation();
670
693
  _fnEventFire( "action", _iOldX, _iOldY );
671
694
  return true;
672
695
 
@@ -699,7 +722,7 @@ function KeyTable ( oInit )
699
722
  _bInputFocused = true;
700
723
  _nInput.focus();
701
724
 
702
- /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for
725
+ /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for
703
726
  * focus
704
727
  */
705
728
  setTimeout( function(){ _bInputFocused = false; }, 0 );
@@ -723,6 +746,19 @@ function KeyTable ( oInit )
723
746
  }
724
747
  break;
725
748
 
749
+ case 36: /* home */
750
+ x = _iOldX;
751
+ y = 0;
752
+ break;
753
+
754
+ case 33: /* page up */
755
+ x = _iOldX;
756
+ y = _iOldY - 10;
757
+ if (y < 0) {
758
+ y = 0;
759
+ }
760
+ break;
761
+
726
762
  case 9: /* tab */
727
763
  case 39: /* right arrow */
728
764
  if ( _iOldX < iTableWidth-1 ) {
@@ -741,7 +777,7 @@ function KeyTable ( oInit )
741
777
  _bInputFocused = true;
742
778
  _nInput.focus();
743
779
 
744
- /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for
780
+ /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for
745
781
  * focus
746
782
  */
747
783
  setTimeout( function(){ _bInputFocused = false; }, 0 );
@@ -765,6 +801,19 @@ function KeyTable ( oInit )
765
801
  }
766
802
  break;
767
803
 
804
+ case 35: /* end */
805
+ x = _iOldX;
806
+ y = iTableHeight-1;
807
+ break;
808
+
809
+ case 34: /* page down */
810
+ x = _iOldX;
811
+ y = _iOldY+10;
812
+ if (y > iTableHeight-1) {
813
+ y = iTableHeight-1;
814
+ }
815
+ break;
816
+
768
817
  default: /* Nothing we are interested in */
769
818
  return true;
770
819
  }
@@ -817,10 +866,9 @@ function KeyTable ( oInit )
817
866
  {
818
867
  if ( _oDatatable )
819
868
  {
820
- var oSettings = _oDatatable.fnSettings();
821
- if ( typeof oSettings.aoData[ oSettings.aiDisplay[ y ] ] != 'undefined' )
869
+ if ( typeof _oDatatable.aoData[ _oDatatable.aiDisplay[ y ] ] != 'undefined' )
822
870
  {
823
- return oSettings.aoData[ oSettings.aiDisplay[ y ] ].nTr.getElementsByTagName('td')[x];
871
+ return _oDatatable.aoData[ _oDatatable.aiDisplay[ y ] ].nTr.getElementsByTagName('td')[x];
824
872
  }
825
873
  else
826
874
  {
@@ -829,7 +877,7 @@ function KeyTable ( oInit )
829
877
  }
830
878
  else
831
879
  {
832
- return jQuery('tr:eq('+y+')>td:eq('+x+')', _nBody )[0];
880
+ return $('tr:eq('+y+')>td:eq('+x+')', _nBody )[0];
833
881
  }
834
882
  }
835
883
 
@@ -845,17 +893,16 @@ function KeyTable ( oInit )
845
893
  {
846
894
  if ( _oDatatable )
847
895
  {
848
- var oSettings = _oDatatable.fnSettings();
849
896
  return [
850
- jQuery('td', n.parentNode).index(n),
851
- jQuery('tr', n.parentNode.parentNode).index(n.parentNode) + oSettings._iDisplayStart
897
+ $('td', n.parentNode).index(n),
898
+ $('tr', n.parentNode.parentNode).index(n.parentNode) + _oDatatable._iDisplayStart
852
899
  ];
853
900
  }
854
901
  else
855
902
  {
856
903
  return [
857
- jQuery('td', n.parentNode).index(n),
858
- jQuery('tr', n.parentNode.parentNode).index(n.parentNode)
904
+ $('td', n.parentNode).index(n),
905
+ $('tr', n.parentNode.parentNode).index(n.parentNode)
859
906
  ];
860
907
  }
861
908
  }
@@ -925,10 +972,9 @@ function KeyTable ( oInit )
925
972
  */
926
973
  function _fnFindDtCell( nTarget )
927
974
  {
928
- var oSettings = _oDatatable.fnSettings();
929
- for ( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
975
+ for ( var i=0, iLen=_oDatatable.aiDisplay.length ; i<iLen ; i++ )
930
976
  {
931
- var nTr = oSettings.aoData[ oSettings.aiDisplay[i] ].nTr;
977
+ var nTr = _oDatatable.aoData[ _oDatatable.aiDisplay[i] ].nTr;
932
978
  var nTds = nTr.getElementsByTagName('td');
933
979
  for ( var j=0, jLen=nTds.length ; j<jLen ; j++ )
934
980
  {
@@ -961,7 +1007,7 @@ function KeyTable ( oInit )
961
1007
  * bool:initScroll - scroll the view port on load, default true
962
1008
  * int:tabIndex - the tab index to give the hidden input element
963
1009
  */
964
- function _fnInit( oInit, that )
1010
+ function _fnInit( table, datatable, oInit, that )
965
1011
  {
966
1012
  /* Save scope */
967
1013
  _that = that;
@@ -975,18 +1021,15 @@ function KeyTable ( oInit )
975
1021
  oInit.focus = [0,0];
976
1022
  }
977
1023
 
978
- if ( typeof oInit.table == 'undefined' ) {
979
- oInit.table = jQuery('table.KeyTable')[0];
980
- } else {
981
- $(oInit.table).addClass('KeyTable');
982
- }
1024
+ oInit.table = table;
1025
+ $(oInit.table).addClass('KeyTable');
983
1026
 
984
1027
  if ( typeof oInit.focusClass != 'undefined' ) {
985
1028
  _sFocusClass = oInit.focusClass;
986
1029
  }
987
1030
 
988
- if ( typeof oInit.datatable != 'undefined' ) {
989
- _oDatatable = oInit.datatable;
1031
+ if ( typeof datatable != 'undefined' ) {
1032
+ _oDatatable = datatable;
990
1033
  }
991
1034
 
992
1035
  if ( typeof oInit.initScroll == 'undefined' ) {
@@ -1018,7 +1061,7 @@ function KeyTable ( oInit )
1018
1061
  nDiv.appendChild(_nInput);
1019
1062
  oInit.table.parentNode.insertBefore( nDiv, oInit.table.nextSibling );
1020
1063
 
1021
- jQuery(_nInput).focus( function () {
1064
+ $(_nInput).focus( function () {
1022
1065
  /* See if we want to 'tab into' the table or out */
1023
1066
  if ( !_bInputFocused )
1024
1067
  {
@@ -1053,41 +1096,20 @@ function KeyTable ( oInit )
1053
1096
  _fnCaptureKeys();
1054
1097
  }
1055
1098
 
1056
- /*
1057
- * Add event listeners
1058
- * Well - I hate myself for doing this, but it would appear that key events in browsers are
1059
- * a complete mess, particulay when you consider arrow keys, which of course are one of the
1060
- * main areas of interest here. So basically for arrow keys, there is no keypress event in
1061
- * Safari and IE, while there is in Firefox and Opera. But Firefox and Opera don't repeat the
1062
- * keydown event for an arrow key. OUCH. See the following two articles for more:
1063
- * http://www.quirksmode.org/dom/events/keys.html
1064
- * https://lists.webkit.org/pipermail/webkit-dev/2007-December/002992.html
1065
- * http://unixpapa.com/js/key.html
1066
- * PPK considers the IE / Safari method correct (good enough for me!) so we (urgh) detect
1067
- * Mozilla and Opera and apply keypress for them, while everything else gets keydown. If
1068
- * Mozilla or Opera change their implemention in future, this will need to be updated...
1069
- * although at the time of writing (14th March 2009) Minefield still uses the 3.0 behaviour.
1070
- */
1071
- if ( jQuery.browser.mozilla || jQuery.browser.opera )
1072
- {
1073
- jQuery(document).bind( "keypress", _fnKey );
1074
- }
1075
- else
1076
- {
1077
- jQuery(document).bind( "keydown", _fnKey );
1078
- }
1099
+ /* Add event listeners */
1100
+ $(document).bind( "keydown", _fnKey );
1079
1101
 
1080
1102
  if ( _oDatatable )
1081
1103
  {
1082
- jQuery('tbody td', _oDatatable.fnSettings().nTable).live( 'click', _fnClick );
1104
+ $(_oDatatable.nTable).on( 'click', 'td', _fnClick );
1083
1105
  }
1084
1106
  else
1085
1107
  {
1086
- jQuery('td', _nBody).live( 'click', _fnClick );
1108
+ $(_nBody).on( 'click', 'td', _fnClick );
1087
1109
  }
1088
1110
 
1089
1111
  /* Loose table focus when click outside the table */
1090
- jQuery(document).click( function(e) {
1112
+ $(document).click( function(e) {
1091
1113
  var nTarget = e.target;
1092
1114
  var bTableClick = false;
1093
1115
  while ( nTarget )
@@ -1106,6 +1128,44 @@ function KeyTable ( oInit )
1106
1128
  } );
1107
1129
  }
1108
1130
 
1131
+ var table, datatable;
1132
+
1133
+ if ( oInit === undefined ) {
1134
+ table = $('table.KeyTable')[0];
1135
+ datatable = null;
1136
+ }
1137
+ else if ( $.isPlainObject( oInit ) ) {
1138
+ table = oInit.table;
1139
+ datatable = oInit.datatable;
1140
+ }
1141
+ else {
1142
+ datatable = new $.fn.dataTable.Api( oInit ).settings()[0];
1143
+ table = datatable.nTable;
1144
+ }
1109
1145
  /* Initialise our new object */
1110
- _fnInit( oInit, this );
1111
- }
1146
+ _fnInit( table, datatable, oInit, this );
1147
+ };
1148
+
1149
+
1150
+ KeyTable.version = "1.2.0";
1151
+
1152
+
1153
+ $.fn.dataTable.KeyTable = KeyTable;
1154
+ $.fn.DataTable.KeyTable = KeyTable;
1155
+
1156
+
1157
+ return KeyTable;
1158
+ }; // /factory
1159
+
1160
+
1161
+ // Define as an AMD module if possible
1162
+ if ( typeof define === 'function' && define.amd ) {
1163
+ define( 'datatables-keytable', ['jquery', 'datatables'], factory );
1164
+ }
1165
+ else if ( jQuery && !jQuery.fn.dataTable.KeyTable ) {
1166
+ // Otherwise simply initialise as normal, stopping multiple evaluation
1167
+ factory( jQuery, jQuery.fn.dataTable );
1168
+ }
1169
+
1170
+
1171
+ })(window, document);