react-hot-keys
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "react-hot-keys", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.", | ||
@@ -24,3 +24,3 @@ "author": "kenny wang <wowohoo@qq.com>", | ||
"dependencies": { | ||
"hotkeys-js": "^3.4.4" | ||
"hotkeys-js": "^3.6.2" | ||
}, | ||
@@ -35,4 +35,4 @@ "peerDependencies": { | ||
"prop-types": "^15.6.0", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0" | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4" | ||
}, | ||
@@ -39,0 +39,0 @@ "homepage": "https://jaywcjlove.github.io/react-hotkeys/", |
@@ -28,9 +28,9 @@ react-hotkeys | ||
Preview [demo](https://jaywcjlove.github.io/react-hotkeys/). | ||
Preview [demo](https://jaywcjlove.github.io/react-hotkeys/). [Codepen example](https://codepen.io/jaywcjlove/pen/bJxbwG). | ||
```js | ||
import React, { Component } from 'react'; | ||
import React from 'react'; | ||
import Hotkeys from 'react-hot-keys'; | ||
export default class HotkeysDemo extends Component { | ||
export default class HotkeysDemo extends React.Component { | ||
constructor(props) { | ||
@@ -37,0 +37,0 @@ super(props); |
/*! | ||
* react-hot-keys v1.2.2 - https://jaywcjlove.github.io/react-hotkeys/ | ||
* react-hot-keys v1.3.1 - https://jaywcjlove.github.io/react-hotkeys/ | ||
* MIT Licensed | ||
@@ -112,3 +112,3 @@ */ | ||
if (false) { var throwOnDirectAccess, isValidElement, REACT_ELEMENT_TYPE; } else { | ||
if (false) { var throwOnDirectAccess, ReactIs; } else { | ||
// By explicitly using `prop-types` you are opting into new production behavior. | ||
@@ -130,3 +130,3 @@ // http://fb.me/prop-types-in-prod | ||
module.exports = __webpack_require__(7); | ||
module.exports = __webpack_require__(5); | ||
@@ -148,6 +148,8 @@ | ||
var emptyFunction = __webpack_require__(4); | ||
var invariant = __webpack_require__(5); | ||
var ReactPropTypesSecret = __webpack_require__(6); | ||
var ReactPropTypesSecret = __webpack_require__(4); | ||
function emptyFunction() {} | ||
function emptyFunctionWithReset() {} | ||
emptyFunctionWithReset.resetWarningCache = emptyFunction; | ||
module.exports = function() { | ||
@@ -159,4 +161,3 @@ function shim(props, propName, componentName, location, propFullName, secret) { | ||
} | ||
invariant( | ||
false, | ||
var err = new Error( | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
@@ -166,2 +167,4 @@ 'Use PropTypes.checkPropTypes() to call them. ' + | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
}; | ||
@@ -186,2 +189,3 @@ shim.isRequired = shim; | ||
element: shim, | ||
elementType: shim, | ||
instanceOf: getShim, | ||
@@ -193,6 +197,8 @@ node: shim, | ||
shape: getShim, | ||
exact: getShim | ||
exact: getShim, | ||
checkPropTypes: emptyFunctionWithReset, | ||
resetWarningCache: emptyFunction | ||
}; | ||
ReactPropTypes.checkPropTypes = emptyFunction; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
@@ -209,4 +215,2 @@ | ||
"use strict"; | ||
/** | ||
@@ -217,99 +221,6 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
function makeEmptyFunction(arg) { | ||
return function () { | ||
return arg; | ||
}; | ||
} | ||
/** | ||
* This function accepts and discards inputs; it has no side effects. This is | ||
* primarily useful idiomatically for overridable function endpoints which | ||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
*/ | ||
var emptyFunction = function emptyFunction() {}; | ||
emptyFunction.thatReturns = makeEmptyFunction; | ||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
emptyFunction.thatReturnsThis = function () { | ||
return this; | ||
}; | ||
emptyFunction.thatReturnsArgument = function (arg) { | ||
return arg; | ||
}; | ||
module.exports = emptyFunction; | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
/** | ||
* Use invariant() to assert state which your program assumes to be true. | ||
* | ||
* Provide sprintf-style format (only %s is supported) and arguments | ||
* to provide information about what broke and what you were | ||
* expecting. | ||
* | ||
* The invariant message will be stripped in production, but the invariant | ||
* will remain to ensure logic does not differ in production. | ||
*/ | ||
var validateFormat = function validateFormat(format) {}; | ||
if (false) {} | ||
function invariant(condition, format, a, b, c, d, e, f) { | ||
validateFormat(format); | ||
if (!condition) { | ||
var error; | ||
if (format === undefined) { | ||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
} else { | ||
var args = [a, b, c, d, e, f]; | ||
var argIndex = 0; | ||
error = new Error(format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
})); | ||
error.name = 'Invariant Violation'; | ||
} | ||
error.framesToPop = 1; // we don't care about invariant's own frame | ||
throw error; | ||
} | ||
} | ||
module.exports = invariant; | ||
/***/ }), | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
@@ -321,3 +232,3 @@ | ||
/***/ }), | ||
/* 7 */ | ||
/* 5 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -337,3 +248,3 @@ | ||
/*! | ||
* hotkeys-js v3.4.4 | ||
* hotkeys-js v3.6.2 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
@@ -530,3 +441,9 @@ * | ||
// 从列表中清除按压过的键 | ||
if (i >= 0) _downKeys.splice(i, 1); | ||
if (i >= 0) { | ||
_downKeys.splice(i, 1); | ||
} | ||
// 特殊处理 cmmand 键,在 cmmand 组合快捷键 keyup 只执行一次的问题 | ||
if (event.key && event.key.toLowerCase() === 'meta') { | ||
_downKeys.splice(0, _downKeys.length); | ||
} | ||
@@ -655,3 +572,5 @@ // 修饰键 shiftKey altKey ctrlKey (command||metaKey) 清除 | ||
for (var i = 0; i < asterisk.length; i++) { | ||
if (asterisk[i].scope === scope) eventHandler(event, asterisk[i], scope); | ||
if (asterisk[i].scope === scope && (event.type === 'keydown' && !asterisk[i].keyup || event.type === 'keyup' && asterisk[i].keyup)) { | ||
eventHandler(event, asterisk[i], scope); | ||
} | ||
} | ||
@@ -663,4 +582,16 @@ } | ||
for (var _i = 0; _i < _handlers[key].length; _i++) { | ||
// 找到处理内容 | ||
eventHandler(event, _handlers[key][_i], scope); | ||
if (event.type === 'keydown' && !_handlers[key][_i].keyup || event.type === 'keyup' && _handlers[key][_i].keyup) { | ||
if (_handlers[key][_i].key) { | ||
var keyShortcut = _handlers[key][_i].key.split('+'); | ||
var _downKeysCurrent = []; // 记录当前按键键值 | ||
for (var a = 0; a < keyShortcut.length; a++) { | ||
_downKeysCurrent.push(code(keyShortcut[a])); | ||
} | ||
_downKeysCurrent = _downKeysCurrent.sort(); | ||
if (_downKeysCurrent.join('') === _downKeys.sort().join('')) { | ||
// 找到处理内容 | ||
eventHandler(event, _handlers[key][_i], scope); | ||
} | ||
} | ||
} | ||
} | ||
@@ -702,4 +633,4 @@ } | ||
if (!(key in _handlers)) _handlers[key] = []; | ||
_handlers[key].push({ | ||
keyup: option.keyup, | ||
scope: scope, | ||
@@ -719,2 +650,3 @@ mods: mods, | ||
addEvent(element, 'keyup', function (e) { | ||
dispatch(e); | ||
clearModifier(e); | ||
@@ -721,0 +653,0 @@ }); |
/*! | ||
* react-hot-keys v1.2.2 - https://jaywcjlove.github.io/react-hotkeys/ | ||
* react-hot-keys v1.3.1 - https://jaywcjlove.github.io/react-hotkeys/ | ||
* MIT Licensed | ||
@@ -7,3 +7,3 @@ */ | ||
/*! | ||
* hotkeys-js v3.4.4 | ||
* hotkeys-js v3.6.2 | ||
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. | ||
@@ -15,3 +15,3 @@ * | ||
* Licensed under the MIT license. | ||
*/function i(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){n(window.event)})}function a(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function c(e){e||(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function f(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i<n.length;i++)-1===o.indexOf(n[i])&&(r=!1);return r}for(var s={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,"⇪":20,",":188,".":190,"/":191,"`":192,"-":r?173:189,"=":r?61:187,";":r?59:186,"'":222,"[":219,"]":221,"\\":220},u={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":r?224:91,cmd:r?224:91,command:r?224:91},l=[],p={16:"shiftKey",18:"altKey",17:"ctrlKey"},d={16:!1,18:!1,17:!1},h={},y=1;y<20;y++)s["f"+y]=111+y;p[r?224:91]="metaKey",d[r?224:91]=!1;var v="all",b=!1,w=function(e){return s[e.toLowerCase()]||u[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function g(e){v=e||"all"}function m(){return v||"all"}function O(e,t,n){var o=void 0;if(t.scope===n||"all"===t.scope){for(var r in o=t.mods.length>0,d)Object.prototype.hasOwnProperty.call(d,r)&&(!d[r]&&t.mods.indexOf(+r)>-1||d[r]&&-1===t.mods.indexOf(+r))&&(o=!1);(0!==t.mods.length||d[16]||d[18]||d[17]||d[91])&&!o&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function K(e,t,n){var o=c(e),r=[],f="all",s=document,y=0;for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(f=t.scope),t.element&&(s=t.element)),"string"==typeof t&&(f=t);y<o.length;y++)r=[],(e=o[y].split("+")).length>1&&(r=a(u,e)),(e="*"===(e=e[e.length-1])?"*":w(e))in h||(h[e]=[]),h[e].push({scope:f,mods:r,shortcut:o[y],method:n,key:o[y]});void 0===s||b||(b=!0,i(s,"keydown",function(e){!function(e){var t=h["*"],n=e.keyCode||e.which||e.charCode;if(-1===l.indexOf(n)&&l.push(n),93!==n&&224!==n||(n=91),n in d){for(var o in d[n]=!0,u)u[o]===n&&(K[o]=!0);if(!t)return}for(var r in d)Object.prototype.hasOwnProperty.call(d,r)&&(d[r]=e[p[r]]);if(K.filter.call(this,e)){var i=m();if(t)for(var a=0;a<t.length;a++)t[a].scope===i&&O(e,t[a],i);if(n in h)for(var c=0;c<h[n].length;c++)O(e,h[n][c],i)}}(e)}),i(s,"keyup",function(e){!function(e){var t=e.keyCode||e.which||e.charCode,n=l.indexOf(t);if(n>=0&&l.splice(n,1),93!==t&&224!==t||(t=91),t in d)for(var o in d[t]=!1,u)u[o]===t&&(K[o]=!1)}(e)}))}var E={setScope:g,getScope:m,deleteScope:function(e,t){var n=void 0,o=void 0;for(var r in e||(e=m()),h)if(Object.prototype.hasOwnProperty.call(h,r))for(n=h[r],o=0;o<n.length;)n[o].scope===e?n.splice(o,1):o++;m()===e&&g(t||"all")},getPressedKeyCodes:function(){return l.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=w(e)),-1!==l.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n||t.isContentEditable)},unbind:function(e,t,n){var o=c(e),r=void 0,i=[],s=void 0;"function"==typeof t&&(n=t,t="all");for(var l=0;l<o.length;l++){if((r=o[l].split("+")).length>1&&(i=a(u,r)),e="*"===(e=r[r.length-1])?"*":w(e),t||(t=m()),!h[e])return;for(var p=0;p<h[e].length;p++)s=h[e][p],(!n||s.method===n)&&s.scope===t&&f(s.mods,i)&&(h[e][p]={})}}};for(var x in E)Object.prototype.hasOwnProperty.call(E,x)&&(K[x]=E[x]);if("undefined"!=typeof window){var j=window.hotkeys;K.noConflict=function(e){return e&&window.hotkeys===K&&(window.hotkeys=j),K},window.hotkeys=K}var k=K;n.d(t,"default",function(){return C});var C=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.onKeyDown=o.onKeyDown.bind(o),o.onKeyUp=o.onKeyUp.bind(o),o.handleKeyUpEvent=o.handleKeyUpEvent.bind(o),o.isKeyDown=!1,o.handle={},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentDidMount=function(){var e=this.props.filter;k.filter=e,k.unbind(this.props.keyName),k(this.props.keyName,this.onKeyDown),document.addEventListener("keyup",this.handleKeyUpEvent)},t.prototype.componentWillUnmount=function(){k.unbind(this.props.keyName),this.isKeyDown=!0,this.handle={},document.removeEventListener("keyup",this.handleKeyUpEvent)},t.prototype.onKeyUp=function(e,t){var n=this.props.onKeyUp;n(t.shortcut,e,t)},t.prototype.onKeyDown=function(e,t){var n=this.props.onKeyDown;this.isKeyDown||(this.isKeyDown=!0,this.handle=t,n(t.shortcut,e,t))},t.prototype.handleKeyUpEvent=function(e){this.isKeyDown&&(this.isKeyDown=!1,this.props.keyName.indexOf(this.handle.shortcut)<0||(this.onKeyUp(e,this.handle),this.handle={}))},t.prototype.render=function(){return this.props.children||null},t}(o.Component);C.defaultProps={filter:function(e){var t=(e.target||e.srcElement).tagName;return!(t.isContentEditable||"INPUT"==t||"SELECT"==t||"TEXTAREA"==t)},onKeyUp:function(){},onKeyDown:function(){}}}]).default}); | ||
*/function i(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){n(window.event)})}function a(e,t){for(var n=t.slice(0,t.length-1),o=0;o<n.length;o++)n[o]=e[n[o].toLowerCase()];return n}function c(e){e||(e="");for(var t=(e=e.replace(/\s/g,"")).split(","),n=t.lastIndexOf("");n>=0;)t[n-1]+=",",t.splice(n,1),n=t.lastIndexOf("");return t}function p(e,t){for(var n=e.length>=t.length?e:t,o=e.length>=t.length?t:e,r=!0,i=0;i<n.length;i++)-1===o.indexOf(n[i])&&(r=!1);return r}for(var s={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,"⇪":20,",":188,".":190,"/":191,"`":192,"-":r?173:189,"=":r?61:187,";":r?59:186,"'":222,"[":219,"]":221,"\\":220},u={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":r?224:91,cmd:r?224:91,command:r?224:91},f=[],l={16:"shiftKey",18:"altKey",17:"ctrlKey"},d={16:!1,18:!1,17:!1},y={},h=1;h<20;h++)s["f"+h]=111+h;l[r?224:91]="metaKey",d[r?224:91]=!1;var v="all",w=!1,b=function(e){return s[e.toLowerCase()]||u[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function g(e){v=e||"all"}function m(){return v||"all"}function k(e,t,n){var o=void 0;if(t.scope===n||"all"===t.scope){for(var r in o=t.mods.length>0,d)Object.prototype.hasOwnProperty.call(d,r)&&(!d[r]&&t.mods.indexOf(+r)>-1||d[r]&&-1===t.mods.indexOf(+r))&&(o=!1);(0!==t.mods.length||d[16]||d[18]||d[17]||d[91])&&!o&&"*"!==t.shortcut||!1===t.method(e,t)&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function O(e){var t=y["*"],n=e.keyCode||e.which||e.charCode;if(-1===f.indexOf(n)&&f.push(n),93!==n&&224!==n||(n=91),n in d){for(var o in d[n]=!0,u)u[o]===n&&(K[o]=!0);if(!t)return}for(var r in d)Object.prototype.hasOwnProperty.call(d,r)&&(d[r]=e[l[r]]);if(K.filter.call(this,e)){var i=m();if(t)for(var a=0;a<t.length;a++)t[a].scope===i&&("keydown"===e.type&&!t[a].keyup||"keyup"===e.type&&t[a].keyup)&&k(e,t[a],i);if(n in y)for(var c=0;c<y[n].length;c++)if(("keydown"===e.type&&!y[n][c].keyup||"keyup"===e.type&&y[n][c].keyup)&&y[n][c].key){for(var p=y[n][c].key.split("+"),s=[],h=0;h<p.length;h++)s.push(b(p[h]));(s=s.sort()).join("")===f.sort().join("")&&k(e,y[n][c],i)}}}function K(e,t,n){var o=c(e),r=[],p="all",s=document,l=0;for(void 0===n&&"function"==typeof t&&(n=t),"[object Object]"===Object.prototype.toString.call(t)&&(t.scope&&(p=t.scope),t.element&&(s=t.element)),"string"==typeof t&&(p=t);l<o.length;l++)r=[],(e=o[l].split("+")).length>1&&(r=a(u,e)),(e="*"===(e=e[e.length-1])?"*":b(e))in y||(y[e]=[]),y[e].push({keyup:t.keyup,scope:p,mods:r,shortcut:o[l],method:n,key:o[l]});void 0===s||w||(w=!0,i(s,"keydown",function(e){O(e)}),i(s,"keyup",function(e){O(e),function(e){var t=e.keyCode||e.which||e.charCode,n=f.indexOf(t);if(n>=0&&f.splice(n,1),e.key&&"meta"===e.key.toLowerCase()&&f.splice(0,f.length),93!==t&&224!==t||(t=91),t in d)for(var o in d[t]=!1,u)u[o]===t&&(K[o]=!1)}(e)}))}var E={setScope:g,getScope:m,deleteScope:function(e,t){var n=void 0,o=void 0;for(var r in e||(e=m()),y)if(Object.prototype.hasOwnProperty.call(y,r))for(n=y[r],o=0;o<n.length;)n[o].scope===e?n.splice(o,1):o++;m()===e&&g(t||"all")},getPressedKeyCodes:function(){return f.slice(0)},isPressed:function(e){return"string"==typeof e&&(e=b(e)),-1!==f.indexOf(e)},filter:function(e){var t=e.target||e.srcElement,n=t.tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n||t.isContentEditable)},unbind:function(e,t,n){var o=c(e),r=void 0,i=[],s=void 0;"function"==typeof t&&(n=t,t="all");for(var f=0;f<o.length;f++){if((r=o[f].split("+")).length>1&&(i=a(u,r)),e="*"===(e=r[r.length-1])?"*":b(e),t||(t=m()),!y[e])return;for(var l=0;l<y[e].length;l++)s=y[e][l],(!n||s.method===n)&&s.scope===t&&p(s.mods,i)&&(y[e][l]={})}}};for(var j in E)Object.prototype.hasOwnProperty.call(E,j)&&(K[j]=E[j]);if("undefined"!=typeof window){var x=window.hotkeys;K.noConflict=function(e){return e&&window.hotkeys===K&&(window.hotkeys=x),K},window.hotkeys=K}var C=K;n.d(t,"default",function(){return P});var P=function(e){function t(n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,n));return o.onKeyDown=o.onKeyDown.bind(o),o.onKeyUp=o.onKeyUp.bind(o),o.handleKeyUpEvent=o.handleKeyUpEvent.bind(o),o.isKeyDown=!1,o.handle={},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.componentDidMount=function(){var e=this.props.filter;C.filter=e,C.unbind(this.props.keyName),C(this.props.keyName,this.onKeyDown),document.addEventListener("keyup",this.handleKeyUpEvent)},t.prototype.componentWillUnmount=function(){C.unbind(this.props.keyName),this.isKeyDown=!0,this.handle={},document.removeEventListener("keyup",this.handleKeyUpEvent)},t.prototype.onKeyUp=function(e,t){var n=this.props.onKeyUp;n(t.shortcut,e,t)},t.prototype.onKeyDown=function(e,t){var n=this.props.onKeyDown;this.isKeyDown||(this.isKeyDown=!0,this.handle=t,n(t.shortcut,e,t))},t.prototype.handleKeyUpEvent=function(e){this.isKeyDown&&(this.isKeyDown=!1,this.props.keyName.indexOf(this.handle.shortcut)<0||(this.onKeyUp(e,this.handle),this.handle={}))},t.prototype.render=function(){return this.props.children||null},t}(o.Component);P.defaultProps={filter:function(e){var t=(e.target||e.srcElement).tagName;return!(t.isContentEditable||"INPUT"==t||"SELECT"==t||"TEXTAREA"==t)},onKeyUp:function(){},onKeyDown:function(){}}}]).default}); | ||
//# sourceMappingURL=react-hot-keys.min.js.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70097
831
Updatedhotkeys-js@^3.6.2