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