refactor(utils): rename function
This commit is contained in:
10
dist/ReactGraph.js
vendored
10
dist/ReactGraph.js
vendored
@@ -33810,7 +33810,7 @@
|
||||
var isFunction = function isFunction(obj) {
|
||||
return !!(obj && obj.constructor && obj.call && obj.apply);
|
||||
};
|
||||
var isInputNode = function isInputNode(e) {
|
||||
var inInputDOMNode = function inInputDOMNode(e) {
|
||||
return e && e.target && ['INPUT', 'SELECT', 'TEXTAREA'].includes(e.target.nodeName);
|
||||
};
|
||||
var getDimensions = function getDimensions() {
|
||||
@@ -33831,7 +33831,7 @@
|
||||
var key = _ref.key,
|
||||
target = _ref.target;
|
||||
|
||||
if (key === targetKey && !isInputNode(target)) {
|
||||
if (key === targetKey && !inInputDOMNode(target)) {
|
||||
setKeyPressed(true);
|
||||
}
|
||||
}
|
||||
@@ -33840,7 +33840,7 @@
|
||||
var key = _ref2.key,
|
||||
target = _ref2.target;
|
||||
|
||||
if (key === targetKey && !isInputNode(target)) {
|
||||
if (key === targetKey && !inInputDOMNode(target)) {
|
||||
setKeyPressed(false);
|
||||
}
|
||||
};
|
||||
@@ -34235,7 +34235,7 @@
|
||||
position = _ref.position,
|
||||
transform = _ref.transform;
|
||||
|
||||
if (isInputNode(evt) || isHandle(evt)) {
|
||||
if (inInputDOMNode(evt) || isHandle(evt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -34528,7 +34528,7 @@
|
||||
});
|
||||
|
||||
var onEdgeClick = function onEdgeClick(evt) {
|
||||
if (isInputNode(evt)) {
|
||||
if (inInputDOMNode(evt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { memo } from 'react';
|
||||
import cx from 'classnames';
|
||||
|
||||
import { isInputNode } from '../../utils';
|
||||
import { inInputDOMNode } from '../../utils';
|
||||
import store from '../../store';
|
||||
|
||||
export default EdgeComponent => {
|
||||
@@ -12,7 +12,7 @@ export default EdgeComponent => {
|
||||
} = props;
|
||||
const edgeClasses = cx('react-flow__edge', { selected, animated });
|
||||
const onEdgeClick = (evt) => {
|
||||
if (isInputNode(evt)) {
|
||||
if (inInputDOMNode(evt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState, memo } from 'react';
|
||||
import ReactDraggable from 'react-draggable';
|
||||
import cx from 'classnames';
|
||||
|
||||
import { getDimensions, isInputNode } from '../../utils';
|
||||
import { getDimensions, inInputDOMNode } from '../../utils';
|
||||
import { Provider } from '../../contexts/NodeIdContext';
|
||||
import store from '../../store';
|
||||
|
||||
@@ -45,7 +45,7 @@ const getHandleBounds = (sel, nodeElement, parentBounds, k) => {
|
||||
};
|
||||
|
||||
const onStart = (evt, { setOffset, onClick, id, type, data, position, transform }) => {
|
||||
if (isInputNode(evt) || isHandle(evt)) {
|
||||
if (inInputDOMNode(evt) || isHandle(evt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import { isInputNode } from '../utils';
|
||||
import { inInputDOMNode } from '../utils';
|
||||
|
||||
export default function useKeyPress(keyCode) {
|
||||
const [keyPressed, setKeyPressed] = useState(false);
|
||||
|
||||
function downHandler(evt) {
|
||||
if (evt.keyCode === keyCode && !isInputNode(evt.target)) {
|
||||
if (evt.keyCode === keyCode && !inInputDOMNode(evt.target)) {
|
||||
setKeyPressed(true);
|
||||
}
|
||||
}
|
||||
|
||||
const upHandler = (evt) => {
|
||||
if (evt.keyCode === keyCode && !isInputNode(evt.target)) {
|
||||
if (evt.keyCode === keyCode && !inInputDOMNode(evt.target)) {
|
||||
setKeyPressed(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const isFunction = obj => !!(obj && obj.constructor && obj.call && obj.apply);
|
||||
|
||||
export const isInputNode = e => e && e.target && ['INPUT', 'SELECT', 'TEXTAREA'].includes(e.target.nodeName);
|
||||
export const inInputDOMNode = e => e && e.target && ['INPUT', 'SELECT', 'TEXTAREA'].includes(e.target.nodeName);
|
||||
|
||||
export const getDimensions = (node = {}) => ({
|
||||
width: node.offsetWidth,
|
||||
|
||||
Reference in New Issue
Block a user