corrade-nucleus-nucleons
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/src/extensions/key-events/README.md |
@@ -0,0 +1,24 @@ |
# Table Key Events |
|
Use Plugin: [bootstrap-table-key-events](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/key-events) |
|
## Usage |
|
```html |
<script src="extensions/key-events/bootstrap-table-key-events.js"></script> |
``` |
|
## Options |
|
### keyEvents |
|
* type: Boolean |
* description: |
True to enable the key events. The key event list is: |
* s: It will be focused the search textbox if it is enabled. |
* r: It will refresh the table if the showRefresh option is enabled. |
* t: It will toggle the table view if the showToggle option is enabled. |
* p: It will fires the pagination switch if the showPaginationSwitch is enabled. |
* left: It will go to prev page if the pagination is true. |
* right: It will go to next page if the pagination is true. |
* default: `false` |
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/src/extensions/key-events/bootstrap-table-key-events.js |
@@ -0,0 +1,80 @@ |
/** |
* @author: Dennis Hernández |
* @webSite: http://djhvscf.github.io/Blog |
* @version: v1.0.0 |
* |
* @update zhixin wen <wenzhixin2010@gmail.com> |
*/ |
|
!function ($) { |
|
'use strict'; |
|
$.extend($.fn.bootstrapTable.defaults, { |
keyEvents: false |
}); |
|
var BootstrapTable = $.fn.bootstrapTable.Constructor, |
_init = BootstrapTable.prototype.init; |
|
BootstrapTable.prototype.init = function () { |
_init.apply(this, Array.prototype.slice.apply(arguments)); |
this.initKeyEvents(); |
}; |
|
BootstrapTable.prototype.initKeyEvents = function () { |
if (this.options.keyEvents) { |
var that = this; |
|
$(document).off('keydown').on('keydown', function (e) { |
var $search = that.$toolbar.find('.search input'), |
$refresh = that.$toolbar.find('button[name="refresh"]'), |
$toggle = that.$toolbar.find('button[name="toggle"]'), |
$paginationSwitch = that.$toolbar.find('button[name="paginationSwitch"]'); |
|
if (document.activeElement === $search.get(0) || !$.contains(document.activeElement ,that.$toolbar.get(0))) { |
return true; |
} |
|
switch (e.keyCode) { |
case 83: //s |
if (!that.options.search) { |
return; |
} |
$search.focus(); |
return false; |
case 82: //r |
if (!that.options.showRefresh) { |
return; |
} |
$refresh.click(); |
return false; |
case 84: //t |
if (!that.options.showToggle) { |
return; |
} |
$toggle.click(); |
return false; |
case 80: //p |
if (!that.options.showPaginationSwitch) { |
return; |
} |
$paginationSwitch.click(); |
return false; |
case 37: // left |
if (!that.options.pagination) { |
return; |
} |
that.prevPage(); |
return false; |
case 39: // right |
if (!that.options.pagination) { |
return; |
} |
that.nextPage(); |
return; |
} |
}); |
} |
}; |
}(jQuery); |
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/src/extensions/key-events/extension.json |
@@ -0,0 +1,17 @@ |
{ |
"name": "Key Events", |
"version": "1.0.0", |
"description": "Plugin to support the key events in the bootstrap table.", |
"url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/key-events", |
"example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/key-events.html", |
|
"plugins": [{ |
"name": "bootstrap-table-key-events", |
"url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/key-events" |
}], |
|
"author": { |
"name": "djhvscf", |
"image": "https://avatars1.githubusercontent.com/u/4496763" |
} |
} |