Skip to content

Commit aa730b3

Browse files
Upgrade extensions to match DT v1.10.2 package
Add CommonJS loader support and make AMD loader anonymous
1 parent 70136b7 commit aa730b3

11 files changed

+1105
-752
lines changed

Diff for: app/assets/javascripts/dataTables/extras/dataTables.autoFill.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*! AutoFill 1.2.0
1+
/*! AutoFill 1.2.1
22
* ©2008-2014 SpryMedia Ltd - datatables.net/license
33
*/
44

55
/**
66
* @summary AutoFill
77
* @description Add Excel like click and drag auto-fill options to DataTables
8-
* @version 1.2.0
8+
* @version 1.2.1
99
* @file dataTables.autoFill.js
1010
* @author SpryMedia Ltd (www.sprymedia.co.uk)
1111
* @contact www.sprymedia.co.uk/contact
@@ -720,7 +720,7 @@ DataTable.AutoFill = AutoFill;
720720
* @type String
721721
* @default See code
722722
*/
723-
AutoFill.version = "1.2.0";
723+
AutoFill.version = "1.2.1";
724724

725725

726726
/**
@@ -839,7 +839,11 @@ return AutoFill;
839839

840840
// Define as an AMD module if possible
841841
if ( typeof define === 'function' && define.amd ) {
842-
define( 'datatables-autofill', ['jquery', 'datatables'], factory );
842+
define( ['jquery', 'datatables'], factory );
843+
}
844+
else if ( typeof exports === 'object' ) {
845+
// Node/CommonJS
846+
factory( require('jquery'), require('datatables') );
843847
}
844848
else if ( jQuery && !jQuery.fn.dataTable.AutoFill ) {
845849
// Otherwise simply initialise as normal, stopping multiple evaluation

Diff for: app/assets/javascripts/dataTables/extras/dataTables.colVis.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*! ColVis 1.1.0
1+
/*! ColVis 1.1.1
22
* ©2010-2014 SpryMedia Ltd - datatables.net/license
33
*/
44

55
/**
66
* @summary ColVis
77
* @description Controls for column visibility in DataTables
8-
* @version 1.1.0
8+
* @version 1.1.1
99
* @file dataTables.colReorder.js
1010
* @author SpryMedia Ltd (www.sprymedia.co.uk)
1111
* @contact www.sprymedia.co.uk/contact
@@ -463,11 +463,18 @@ ColVis.prototype = {
463463

464464
if ( this.s.showAll )
465465
{
466-
nButton = this._fnDomShowAllButton();
466+
nButton = this._fnDomShowXButton( this.s.showAll, true );
467467
nButton.className += " ColVis_ShowAll";
468468
this.dom.buttons.push( nButton );
469469
}
470470

471+
if ( this.s.showNone )
472+
{
473+
nButton = this._fnDomShowXButton( this.s.showNone, false );
474+
nButton.className += " ColVis_ShowNone";
475+
this.dom.buttons.push( nButton );
476+
}
477+
471478
$(this.dom.collection).append( this.dom.buttons );
472479
},
473480

@@ -502,28 +509,28 @@ ColVis.prototype = {
502509

503510

504511
/**
505-
* Create a button which allows a "show all" action
506-
* @method _fnDomShowAllButton
512+
* Create a button which allows show all and show node actions
513+
* @method _fnDomShowXButton
507514
* @returns {Node} Created button
508515
* @private
509516
*/
510-
"_fnDomShowAllButton": function ()
517+
"_fnDomShowXButton": function ( str, action )
511518
{
512519
var
513520
that = this,
514521
dt = this.s.dt;
515522

516523
return $(
517524
'<li class="ColVis_Special '+(dt.bJUI ? 'ui-button ui-state-default' : '')+'">'+
518-
this.s.showAll+
525+
str+
519526
'</li>'
520527
)
521528
.click( function (e) {
522529
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
523530
{
524531
if (that.s.aiExclude.indexOf(i) === -1)
525532
{
526-
that.s.dt.oInstance.fnSetColumnVis( i, true, false );
533+
that.s.dt.oInstance.fnSetColumnVis( i, action, false );
527534
}
528535
}
529536
that._fnAdjustOpenRows();
@@ -627,7 +634,7 @@ ColVis.prototype = {
627634

628635
$.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
629636

630-
if ( that.s.fnStateChange !== null )
637+
if ( e.target.nodeName.toLowerCase() === 'input' && that.s.fnStateChange !== null )
631638
{
632639
that.s.fnStateChange.call( that, i, showHide );
633640
}
@@ -1039,7 +1046,7 @@ ColVis.prototype.CLASS = "ColVis";
10391046
* @type String
10401047
* @default See code
10411048
*/
1042-
ColVis.VERSION = "1.1.0";
1049+
ColVis.VERSION = "1.1.1";
10431050
ColVis.prototype.VERSION = ColVis.VERSION;
10441051

10451052

@@ -1084,7 +1091,11 @@ return ColVis;
10841091

10851092
// Define as an AMD module if possible
10861093
if ( typeof define === 'function' && define.amd ) {
1087-
define( 'datatables-colvis', ['jquery', 'datatables'], factory );
1094+
define( ['jquery', 'datatables'], factory );
1095+
}
1096+
else if ( typeof exports === 'object' ) {
1097+
// Node/CommonJS
1098+
factory( require('jquery'), require('datatables') );
10881099
}
10891100
else if ( jQuery && !jQuery.fn.dataTable.ColVis ) {
10901101
// Otherwise simply initialise as normal, stopping multiple evaluation

Diff for: app/assets/javascripts/dataTables/extras/dataTables.fixedColumns.js

+32-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*! FixedColumns 3.0.1
1+
/*! FixedColumns 3.0.2
22
* ©2010-2014 SpryMedia Ltd - datatables.net/license
33
*/
44

55
/**
66
* @summary FixedColumns
77
* @description Freeze columns in place on a scrolling DataTable
8-
* @version 3.0.1
8+
* @version 3.0.2
99
* @file dataTables.fixedColumns.js
1010
* @author SpryMedia Ltd (www.sprymedia.co.uk)
1111
* @contact www.sprymedia.co.uk/contact
@@ -483,6 +483,10 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
483483
}
484484
} );
485485

486+
var wheelType = 'onwheel' in document.createElement('div') ?
487+
'wheel.DTFC' :
488+
'mousewheel.DTFC';
489+
486490
if ( that.s.iLeftColumns > 0 ) {
487491
// When scrolling the left column, scroll the body and right column
488492
$(that.dom.grid.left.liner)
@@ -497,9 +501,11 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
497501
}
498502
}
499503
} )
500-
.on( "wheel.DTFC", function(e) {
504+
.on( wheelType, function(e) { // xxx update the destroy as well
501505
// Pass horizontal scrolling through
502-
var xDelta = -e.originalEvent.deltaX;
506+
var xDelta = e.type === 'wheel' ?
507+
-e.originalEvent.deltaX :
508+
e.originalEvent.wheelDeltaX;
503509
that.dom.scroller.scrollLeft -= xDelta;
504510
} );
505511
}
@@ -518,9 +524,11 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
518524
}
519525
}
520526
} )
521-
.on( "wheel.DTFC", function(e) {
527+
.on( wheelType, function(e) {
522528
// Pass horizontal scrolling through
523-
var xDelta = -e.originalEvent.deltaX;
529+
var xDelta = e.type === 'wheel' ?
530+
-e.originalEvent.deltaX :
531+
e.originalEvent.wheelDeltaX;
524532
that.dom.scroller.scrollLeft -= xDelta;
525533
} );
526534
}
@@ -552,10 +560,10 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
552560
$(that.dom.scroller).off( 'scroll.DTFC mouseover.DTFC' );
553561
$(window).off( 'resize.DTFC' );
554562

555-
$(that.dom.grid.left.liner).off( 'scroll.DTFC wheel.DTFC mouseover.DTFC' );
563+
$(that.dom.grid.left.liner).off( 'scroll.DTFC mouseover.DTFC '+wheelType );
556564
$(that.dom.grid.left.wrapper).remove();
557565

558-
$(that.dom.grid.right.liner).off( 'scroll.DTFC wheel.DTFC mouseover.DTFC' );
566+
$(that.dom.grid.right.liner).off( 'scroll.DTFC mouseover.DTFC '+wheelType );
559567
$(that.dom.grid.right.wrapper).remove();
560568
} );
561569

@@ -583,6 +591,7 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
583591

584592
$.each( this.s.dt.aoColumns, function (i, col) {
585593
var th = $(col.nTh);
594+
var border;
586595

587596
if ( ! th.filter(':visible').length ) {
588597
that.s.aiInnerWidths.push( 0 );
@@ -598,7 +607,13 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
598607
// table's border to the outerWidth, since we need to take
599608
// account of it, but it isn't in any cell
600609
if ( that.s.aiOuterWidths.length === 0 ) {
601-
var border = $(that.s.dt.nTable).css('border-left-width');
610+
border = $(that.s.dt.nTable).css('border-left-width');
611+
iWidth += typeof border === 'string' ? 1 : parseInt( border, 10 );
612+
}
613+
614+
// Likewise with the final column on the right
615+
if ( that.s.aiOuterWidths.length === that.s.dt.aoColumns.length-1 ) {
616+
border = $(that.s.dt.nTable).css('border-right-width');
602617
iWidth += typeof border === 'string' ? 1 : parseInt( border, 10 );
603618
}
604619

@@ -724,8 +739,8 @@ FixedColumns.prototype = /** @lends FixedColumns.prototype */{
724739
{
725740
var oGrid = this.dom.grid;
726741
var iWidth = $(oGrid.wrapper).width();
727-
var iBodyHeight = $(this.s.dt.nTable.parentNode).height();
728-
var iFullHeight = $(this.s.dt.nTable.parentNode.parentNode).height();
742+
var iBodyHeight = $(this.s.dt.nTable.parentNode).outerHeight();
743+
var iFullHeight = $(this.s.dt.nTable.parentNode.parentNode).outerHeight();
729744
var oOverflow = this._fnDTOverflow();
730745
var
731746
iLeftWidth = this.s.iLeftWidth,
@@ -1337,7 +1352,7 @@ FixedColumns.defaults = /** @lends FixedColumns.defaults */{
13371352
* @default See code
13381353
* @static
13391354
*/
1340-
FixedColumns.version = "3.0.1";
1355+
FixedColumns.version = "3.0.2";
13411356

13421357

13431358

@@ -1368,7 +1383,11 @@ return FixedColumns;
13681383

13691384
// Define as an AMD module if possible
13701385
if ( typeof define === 'function' && define.amd ) {
1371-
define( 'datatables-fixedcolumns', ['jquery', 'datatables'], factory );
1386+
define( ['jquery', 'datatables'], factory );
1387+
}
1388+
else if ( typeof exports === 'object' ) {
1389+
// Node/CommonJS
1390+
factory( require('jquery'), require('datatables') );
13721391
}
13731392
else if ( jQuery && !jQuery.fn.dataTable.FixedColumns ) {
13741393
// Otherwise simply initialise as normal, stopping multiple evaluation

Diff for: app/assets/javascripts/dataTables/extras/dataTables.fixedHeader.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/*! FixedHeader 2.1.1
1+
/*! FixedHeader 2.1.2
22
* ©2010-2014 SpryMedia Ltd - datatables.net/license
33
*/
44

55
/**
66
* @summary FixedHeader
77
* @description Fix a table's header or footer, so it is always visible while
88
* Scrolling
9-
* @version 2.1.1
9+
* @version 2.1.2
1010
* @file dataTables.fixedHeader.js
1111
* @author SpryMedia Ltd (www.sprymedia.co.uk)
1212
* @contact www.sprymedia.co.uk/contact
@@ -982,7 +982,7 @@ FixedHeader.fnMeasure = function ()
982982
};
983983

984984

985-
FixedHeader.version = "2.1.1";
985+
FixedHeader.version = "2.1.2";
986986

987987

988988
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -1012,7 +1012,11 @@ return FixedHeader;
10121012

10131013
// Define as an AMD module if possible
10141014
if ( typeof define === 'function' && define.amd ) {
1015-
define( 'datatables-fixedheader', ['jquery', 'datatables'], factory );
1015+
define( ['jquery', 'datatables'], factory );
1016+
}
1017+
else if ( typeof exports === 'object' ) {
1018+
// Node/CommonJS
1019+
factory( require('jquery'), require('datatables') );
10161020
}
10171021
else if ( jQuery && !jQuery.fn.dataTable.FixedHeader ) {
10181022
// Otherwise simply initialise as normal, stopping multiple evaluation

Diff for: app/assets/javascripts/dataTables/extras/dataTables.keyTable.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/*! KeyTable 1.2.0
1+
/*! KeyTable 1.2.1
22
* ©2010-2014 SpryMedia Ltd - datatables.net/license
33
*/
44

55
/**
66
* @summary KeyTable
77
* @description Spreadsheet like keyboard navigation for DataTables
8-
* @version 1.2.0
8+
* @version 1.2.1
99
* @file dataTables.keyTable.js
1010
* @author SpryMedia Ltd (www.sprymedia.co.uk)
1111
* @contact www.sprymedia.co.uk/contact
@@ -1147,7 +1147,7 @@ KeyTable = function ( oInit )
11471147
};
11481148

11491149

1150-
KeyTable.version = "1.2.0";
1150+
KeyTable.version = "1.2.1";
11511151

11521152

11531153
$.fn.dataTable.KeyTable = KeyTable;
@@ -1160,7 +1160,11 @@ return KeyTable;
11601160

11611161
// Define as an AMD module if possible
11621162
if ( typeof define === 'function' && define.amd ) {
1163-
define( 'datatables-keytable', ['jquery', 'datatables'], factory );
1163+
define( ['jquery', 'datatables'], factory );
1164+
}
1165+
else if ( typeof exports === 'object' ) {
1166+
// Node/CommonJS
1167+
factory( require('jquery'), require('datatables') );
11641168
}
11651169
else if ( jQuery && !jQuery.fn.dataTable.KeyTable ) {
11661170
// Otherwise simply initialise as normal, stopping multiple evaluation

0 commit comments

Comments
 (0)