Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datatables.net-keytable

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datatables.net-keytable - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

131

js/dataTables.keyTable.js

@@ -1,2 +0,2 @@

/*! KeyTable 2.1.2
/*! KeyTable 2.1.3
* ©2009-2016 SpryMedia Ltd - datatables.net/license

@@ -8,3 +8,3 @@ */

* @description Spreadsheet like keyboard navigation for DataTables
* @version 2.1.2
* @version 2.1.3
* @file dataTables.keyTable.js

@@ -100,3 +100,3 @@ * @author SpryMedia Ltd (www.sprymedia.co.uk)

*/
/**

@@ -171,3 +171,3 @@ * Blur the table's cell focus

// Click to focus
$( dt.table().body() ).on( 'click.keyTable', 'th, td', function () {
$( dt.table().body() ).on( 'click.keyTable', 'th, td', function (e) {
if ( that.s.enable === false ) {

@@ -183,3 +183,3 @@ return;

that._focus( cell, null, false );
that._focus( cell, null, false, e );
} );

@@ -210,2 +210,7 @@

//If the click was inside the fixed columns container, don't blur
if ( $(e.target).parents().filter('.DTFC_Cloned').length ) {
return;
}
that._blur();

@@ -301,2 +306,4 @@ } );

this._updateFixedColumns(cell.index().column);
this._emitEvent( 'key-blur', [ this.s.dt, cell ] );

@@ -352,9 +359,6 @@ },

// Excel style - select all text
var input = $('div.DTE input, div.DTE textarea');
if ( input.length ) {
input[0].select();
}
$('div.DTE input, div.DTE textarea').select();
// Reduce the keys the Keys listens for
dt.keys.enable( 'navigation-only' );
dt.keys.enable( this.c.editorKeys );

@@ -403,3 +407,3 @@ // On blur of the navigation submit

*/
_focus: function ( row, column, shift )
_focus: function ( row, column, shift, originalEvent )
{

@@ -410,2 +414,4 @@ var that = this;

var lastFocus = this.s.lastFocus;
if( ! originalEvent)
originalEvent = null;

@@ -475,2 +481,4 @@ if ( ! this.s.enable ) {

this._updateFixedColumns(column);
// Shift viewpoint and page to make cell visible

@@ -491,3 +499,3 @@ if ( shift === undefined || shift === true ) {

this._emitEvent( 'key-focus', [ this.s.dt, cell ] );
this._emitEvent( 'key-focus', [ this.s.dt, cell, originalEvent || null ] );
dt.state.save();

@@ -505,3 +513,5 @@ },

{
if ( ! this.s.enable ) {
var enable = this.s.enable;
var navEnable = enable === true || enable === 'navigation-only';
if ( ! enable ) {
return;

@@ -530,2 +540,3 @@ }

case 9: // tab
// `enable` can be tab-only
this._shift( e, e.shiftKey ? 'left' : 'right', true );

@@ -535,3 +546,3 @@ break;

case 27: // esc
if ( this.s.blurable && this.s.enable === true ) {
if ( this.s.blurable && enable === true ) {
this._blur();

@@ -543,16 +554,18 @@ }

case 34: // page down (next page)
e.preventDefault();
var index = dt.cells( {page: 'current'} ).nodes().indexOf( cell.node() );
if ( navEnable ) {
e.preventDefault();
var index = dt.cells( {page: 'current'} ).nodes().indexOf( cell.node() );
dt
.one( 'draw', function () {
var nodes = dt.cells( {page: 'current'} ).nodes();
dt
.one( 'draw', function () {
var nodes = dt.cells( {page: 'current'} ).nodes();
that._focus( dt.cell( index < nodes.length ?
nodes[ index ] :
nodes[ nodes.length-1 ]
) );
} )
.page( e.keyCode === 33 ? 'previous' : 'next' )
.draw( false );
that._focus( dt.cell( index < nodes.length ?
nodes[ index ] :
nodes[ nodes.length-1 ]
) , null, true, e);
} )
.page( e.keyCode === 33 ? 'previous' : 'next' )
.draw( false );
}
break;

@@ -562,24 +575,34 @@

case 36: // home (start of current page)
e.preventDefault();
var indexes = dt.cells( {page: 'current'} ).indexes();
if ( navEnable ) {
e.preventDefault();
var indexes = dt.cells( {page: 'current'} ).indexes();
this._focus( dt.cell(
indexes[ e.keyCode === 35 ? indexes.length-1 : 0 ]
) );
this._focus( dt.cell(
indexes[ e.keyCode === 35 ? indexes.length-1 : 0 ]
), null, true, e );
}
break;
case 37: // left arrow
this._shift( e, 'left' );
if ( navEnable ) {
this._shift( e, 'left' );
}
break;
case 38: // up arrow
this._shift( e, 'up' );
if ( navEnable ) {
this._shift( e, 'up' );
}
break;
case 39: // right arrow
this._shift( e, 'right' );
if ( navEnable ) {
this._shift( e, 'right' );
}
break;
case 40: // down arrow
this._shift( e, 'down' );
if ( navEnable ) {
this._shift( e, 'down' );
}
break;

@@ -589,3 +612,3 @@

// Everything else - pass through only when fully enabled
if ( this.s.enable === true ) {
if ( enable === true ) {
this._emitEvent( 'key', [ dt, e.keyCode, this.s.lastFocus, e ] );

@@ -716,3 +739,3 @@ }

this._focus( row, column );
this._focus( row, column, true, e );
}

@@ -757,6 +780,23 @@ else if ( ! keyBlurable || ! this.c.blurable ) {

div.children().on( 'focus', function () {
that._focus( dt.cell(':eq(0)', '0:visible', {page: 'current'}) );
div.children().on( 'focus', function (e) {
that._focus( dt.cell(':eq(0)', '0:visible', {page: 'current'}), null, true, e );
} );
}
},
/**
* Update fixed columns if they are enabled and if the cell we are focusing is inside a fixed column
* @param {integer} column Index of the column being changed
*
* @private
*/
_updateFixedColumns:function(column){
var dt = this.s.dt;
var settings = dt.settings()[0];
if(settings._oFixedColumns){
var leftCols = settings._oFixedColumns.s.iLeftColumns;
var rightCols = settings.aoColumns.length - settings._oFixedColumns.s.iRightColumns;
if (column < leftCols || column > rightCols)
dt.fixedColumns().update();
}
}
} );

@@ -799,2 +839,9 @@

/**
* Option that defines what KeyTable's behaviour will be when used with
* Editor's inline editing. Can be `navigation-only` or `tab-only`.
* @type {String}
*/
editorKeys: 'navigation-only',
/**
* Select a cell to automatically select on start up. `null` for no

@@ -821,3 +868,3 @@ * automatic selection

KeyTable.version = "2.1.2";
KeyTable.version = "2.1.3";

@@ -894,3 +941,3 @@

if ( init || defaults ) {
var opts = $.extend( {}, init, defaults );
var opts = $.extend( {}, defaults, init );

@@ -897,0 +944,0 @@ if ( init !== false ) {

{
"name": "datatables.net-keytable",
"version": "2.1.2",
"version": "2.1.3",
"description": "KeyTable for DataTables ",

@@ -5,0 +5,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc